Webpack Cannot Solve "Style"

I tried to follow the simple Getting Started ( http://webpack.imtqy.com/docs/tutorials/getting-started/ ). And I get this error when I try to load style.css.

A mistake in. /entry.js Module not found: Error: Unable to resolve the "style" in "Project path on my computer" BREAKING CHANGE: It is no longer allowed to omit the suffix '-loader' when using bootloaders. You need to specify "bootloader style" instead of "style". @. / entry.js 1: 0-22

Any ideas?

I installed css-loader and style-loader locally using mpm as described in the tutorial. npm install css-loader style-loader

I see the node-modules module created after installation.

+5
source share
1 answer

For webpack version> = 2.0

Update webpack.config.js

 module.exports = { entry: "./entry.js", output: { path: __dirname, filename: "bundle.js" }, module: { loaders: [ { test: /\.css$/, loader: "style-loader!css-loader" } ] } }; 

Use {test: /. Css $ /, loader: "style-loader! Css-loader"} instead of {test: /. Css $ /, loader: "style! Css!" }

+7
source

Source: https://habr.com/ru/post/1264145/


All Articles