0

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',

2
  • BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.You need to specify 'style-loader' instead of 'style' Looks like you have to use that approach stackoverflow.com/questions/42196583 Commented Nov 29, 2017 at 12:25
  • Possible duplicate of webpack Can't resolve 'style' Commented Nov 30, 2017 at 3:26

2 Answers 2

1

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.

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

Comments

0

I found an answer. I have just added word "-loader" in importing ccs-file like this:

require('style-loader!css-loader!../css/style.css');

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.