0

I install sass-loader, css-loader and style-loader. Here's my webpack config:

var HTMLWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
    template: __dirname + '/app/index.html',
    filename: 'index.html',
    inject: 'body'
});
module.exports = {
    entry: __dirname + '/app/index.js',
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
            },
            {
                test: /\.scss$/,
                loaders: ['style-loader', 'css-loader']
            }
        ]
    },
    output: {
        filename: 'index.js',
        path: __dirname + '/build'
    },
    plugins : [HTMLWebpackPluginConfig]
};

I have 2 scss file within the same folder: main.scss and variable.scss. I want yo import variable .scss into main.scss but failed with the error message:"Module not found: Error: Can't resolve 'variables' ". Here is my main.scss:

@import "variables";

body {
  color: black;
}

1 Answer 1

1

You probably need to install and also add the config for the sass-loader, which also requires node-sass as a dependency: https://github.com/webpack-contrib/sass-loader

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.