sass-loader: `//` comments result in `Unknown word`
If a file has a comment with //
, the loader will fail with the error:
Module build failed: CssSyntaxError: /Users/Greg1/projects/opensignal-toolchain/node_modules/scss-lint-loader/index.js!/Users/Greg1/projects/opensignal-toolchain/lib/css/index.scss:2:4: Unknown word
at Input.error (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/input.js:61:21)
at Parser.unknownDecl (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/parser.js:470:26)
at Parser.decl (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/parser.js:227:22)
at Parser.word (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/parser.js:135:30)
at Parser.loop (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/parser.js:60:26)
at parse (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/parse.js:25:12)
at new LazyResult (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:57:24)
at Processor.process (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/node_modules/postcss/lib/processor.js:36:16)
at processCss (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/lib/processCss.js:165:11)
at Object.module.exports (/Users/Greg1/projects/opensignal-toolchain/node_modules/css-loader/lib/loader.js:22:2)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 5
- Comments: 18 (7 by maintainers)
Commits related to this issue
- [bugfix] fixed cascading order of webpack style loader — committed to pjhjohn/jsonplaceholder-client by pjhjohn 8 years ago
- Fixed https://github.com/webpack-contrib/sass-loader/issues/171 — committed to thomasbrus/create-react-app by thomasbrus 6 years ago
@jhnns false alarm, sorry!
We were mis-using the
ExtractTextPlugin
plugin andsass-loader
wasn’t even invoked, hence the parse error whencss-loader
tried to parse the raw sass.For reference, the corrected version of the loader that we now use is as follows:
Maybe some of the other reported errors are also due to a misconfiguration of something other than
sass-loader
itself.In your configuration, the postcss-loader is executed before the sass-loader. Maybe PostCSS isn’t able to parse SASS? 😁
Could you please create a minimal example that demonstrates the problem? I’m using these comments all the time and there are no problems.