1

From webpack's documentation:

module.exports = { module: { rules: [ { test: /\.css$/, use: [ { loader: ['style-loader'](/loaders/style-loader) }, { loader: ['css-loader'](/loaders/css-loader), options: { modules: true } }, { loader: ['sass-loader'](/loaders/sass-loader) } ] } ] } }; 

What does the following line do?

 { loader: ['style-loader'](/loaders/style-loader) }, 

I pasted it into the console and it's giving me errors and I am not familiar with this kind of syntax in js. AFAIK, webpack configuration should be valid js.

1 Answer 1

1

It should be the following syntax instead:

module.exports = { module: { rules: [ { test: /\.css$/, use: [ { loader: ['style-loader'] }, { loader: ['css-loader'], options: { modules: true } }, { loader: ['sass-loader'] } ] } ] } }; 

I have submitted a PR here to get it fixed in the docs as well.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.