Closed TimBroddin closed 8 years ago
I got it working by commenting out this block in a git checkout of Meteor. Somehow the sourcemap generator got stuck on this.
// Eager CSS is added unconditionally to a combined <style> tag at
// the beginning of the <head>. If the corresponding module ever
// gets imported, its module.exports object should be an empty stub,
// rather than a <style> node added dynamically to the <head>.
self.addJavaScript({
...options,
data: "// These styles have already been applied to the document.\n",
lazy: true
});
(in tools/isobuild/compiler_plugin.js)
Since this is probably a meteor bug, I made an issue there. I also created a project demonstrating this issue: https://github.com/TimBroddin/meteor-css-modules-bug
meteor/meteor#6881
Meteor 1.3.2 changes the way css files are imported. :frowning: I've got some more digging to do, but for now you can probably make it work by changing the outputJsFilePath
option in package.json:
"cssModules": {
"outputJsFilePath": "{dirname}/{basename}{extname}.js"
}
Thanks for digging into it!
Thanks for the quick reply!
I tried just changing the "outputJsFilePath" key in package.json and... complains it can't find files, then the 'attempting to combine different files' error from Meteor. A similar issue was occurring when I tried adding Stylus support, here's my output:
package.json:
"cssModules": {
"extensions": [
"mss",
"scss",
"m.styl"
],
"globalVariables": [
"node_modules/react-toolbox/lib/_colors.scss",
{
"theme-building": true
},
"client/toolbox-theme.scss"
],
"outputJsFilePath": {
".*node_modules/.*": "{dirname}/{basename}{extname}.js"
},
"explicitIncludes": [
"node_modules/react-toolbox"
]
}
Downgrading to 1.3.1 in the meantime.
This one has proven to be bigger than I expected (and life is pretty busy right now). I will probably have a fix or workaround sometime this week.
@nathantreid thanks a lot, I'll keep using my patched up Meteor version until then :)
Hey all, for me I solved both issues (either "Attempting to combine different files" or "Cannot find module") with the following (i.e. no {extname}
in there).
"outputJsFilePath": {
"node_modules/.*": "{dirname}/{basename}.js"
},
Hope this helps! Let us know.
@gadicc that's working on 1.3.2.4?
Yup!
METEOR@1.3.2.4
nathantreid:css-modules@1.1.1*
*
Except if you get a TypeError: Cannot call method 'substr' of undefined
, I had to modify the package to fix this, as per https://github.com/nathantreid/meteor-react-toolbox-example/issues/4#issuecomment-213738655.
This has been fixed in 1.1.2.
I'm getting this error after updating to Meteor 1.3.2.4 with the latest version of meteor-css-modules. I'm debugging this as we speak, so I hope to share the solution with you soon.