Compatibility with postcss-modules
timkelty opened this issue · 4 comments
timkelty commented
I was playing around with postcss-modules
and got this error as long as I was using @csstools/postcss-sass
:
./src/css/index.scss
Module build failed: ModuleBuildError: Module build failed: SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at /Users/timkelty/Sites/coalesse-craft3/node_modules/@csstools/postcss-sass/index.js:100:101
at <anonymous>
at runLoaders (/Users/timkelty/Sites/coalesse-craft3/node_modules/webpack/lib/NormalModule.js:195:19)
at /Users/timkelty/Sites/coalesse-craft3/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /Users/timkelty/Sites/coalesse-craft3/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at context.callback (/Users/timkelty/Sites/coalesse-craft3/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Promise.resolve.then.then.catch (/Users/timkelty/Sites/coalesse-craft3/node_modules/postcss-loader/lib/index.js:189:71)
at <anonymous>
@ ./src/index.js 5:0-26
@ multi ./src/index
./src/css/index.scss
Any idea?
jonathantneal commented
Hi @timkelty, would you let me know if you using &
in your Sass? If so, I will try to patch this bug that is coming libsass. See sass/libsass#2312
If not, would you please give me a reduced snippet of the Sass that will throw the plugin? That will help me identify the problem.
timkelty commented
@jonathantneal nope, the source doesn't seem to matter:
.foo {
background: red;
}
.postcssrc.js
module.exports = ({options}) => {
return {
plugins: {
'@csstools/postcss-sass': {},
'postcss-modules': {},
}
};
}
Order of the plugins don't seem to matter either.
jonathantneal commented
Hi again, @timkelty, I’ve released a new version. Let me know if it resolves the issue for you 😄
timkelty commented
@jonathantneal @csstools/postcss-sass@2.0.0
did the trick!
Thanks so much. 💯