Reputation: 163
I use webpack. I installed style-loader module by command
npm install --save-dev style-loader
I import css-file like-this:
require('style!css!../css/style.css');
But when I run webpack by command
webpack -w --devtool source-map js/profile.js dist/bundle.js
occurs following error:
ERROR in ./js/profile.js Module not found: Error: Can't resolve 'style' in '/home/default-user/WebstormProjects/practice/webpack/js' BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.You need to specify 'style-loader' instead of 'style',
Upvotes: 0
Views: 839
Reputation: 4705
As the error says, Babel does not allow loader specification without the suffix -loader
. So go on and replace style
and css
with style-loader
and css-loader
respectively.
Upvotes: 1
Reputation: 163
I found an answer. I have just added word "-loader" in importing ccs-file like this:
require('style-loader!css-loader!../css/style.css');
Upvotes: 0