akanix42 / meteor-css-modules

MIT License
92 stars 20 forks source link

'Compiling undefined with meteor-babel without a cache' error with Meteor 1.8 / meteor-css-modules 3.2.0 #124

Closed yched closed 5 years ago

yched commented 5 years ago

When building the meteor app (Meteor 1.8 / meteor-css-modules 3.2.0), I get the following error :

Compiling undefined with meteor-babel without a cache
[object Object]
    at Object.exports.compile (/home/yves/.meteor/packages/nathantreid_css-modules/.3.2.0.gtz7vv.455kf++os+web.browser+web.browser.legacy+web.cordova/plugin.mss.os/npm/node_modules/meteor/babel-compiler/node_modules/meteor-babel/index.js:77:13)
    at Object.compile (packages/babel-compiler.js:44:29)
    at tryBabelCompile (packages/mss/css-modules-build-plugin.js:255:22)
    at CssModulesBuildPlugin._generateOutput (packages/mss/css-modules-build-plugin.js:236:9)
    at CssModulesBuildPlugin.compileOneFile (packages/mss/css-modules-build-plugin.js:168:32)
    at async.eachLimit (packages/caching-compiler/multi-file-caching-compiler.js:122:45)
    at /home/yves/.meteor/packages/nathantreid_css-modules/.3.2.0.gtz7vv.455kf++os+web.browser+web.browser.legacy+web.cordova/plugin.mss.os/npm/node_modules/meteor/caching-compiler/node_modules/async/lib/async.js:182:20

Things seem to work fine with version 3.1.4 (even with meteor 1.8)

Maybe this reply by @benjamn could be relevant ?

akanix42 commented 5 years ago

Thanks, that reply probably does hold the solution. I'll take a look at this as soon as I can.

capi1O commented 5 years ago

Any update on this issue ? It's quite annoying because workaround (go back to 3.1.4) does not work for me and very time I update a style file I have to make a change to a JS file otherwise I get this error.

meteor 1.8

akanix42 commented 5 years ago

I've just published nathantreid;css-modules@3.2.3-alpha.1 which should hopefully resolve the Babel error (I can't reproduce it for some reason). Please let me know if it works. However, while testing it I ran into the issue @monkeydri described. This looks like a separate issue, so I've created an issue for it: #125.

yched commented 5 years ago

@nathantreid tried 3.2.3-alpha.1 with both Meteor 1.8.0.1 and 1.8.0.2 : still get the error :-/

Compiling undefined with meteor-babel without a cache
[object Object]
    at Object.exports.compile (/home/yves/.meteor/packages/nathantreid_css-modules/.3.2.3-alpha.1.1ovbuwl.tzyam++os+web.browser+web.browser.legacy+web.cordova/plugin.mss.os/npm/node_modules/meteor/babel-compiler/node_modules/meteor-babel/index.js:79:15)
akanix42 commented 5 years ago

I finally had time to set up Linux for testing and was able to reproduce this. Please try nathantreid:css-modules@3.2.3-beta.3. It seems to have resolved the issue for me.

yched commented 5 years ago

@nathantreid trying nathantreid:css-modules@3.2.3-beta.3 on our Meteor 1.8.0.2 app produces this message with 'meteor run' :

The version of @babel/runtime installed in your node_modules directory 
(7.2.0) contains a breaking change which was introduced by 
https://github.com/babel/babel/pull/8266. Please either downgrade by 
running the following command:

  meteor npm install --save-exact @babel/runtime@7.0.0-beta.55

or update to the latest beta version of Meteor 1.7.1, as explained in 
this pull request: https://github.com/meteor/meteor/pull/9942.

AFAIR, that was a message displayed a couple months ago by Meteor 1.7, that was only compatible with @babel/runtime 7 beta <= 55. However, this is no longer an issue in Meteor 1.8, so I'm a bit surprised to see that message pop up again when trying your 3.2.3-beta.3 ?

After displaying the message, the app boots correctly, but styles are pretty broken : Local (module) styles seem to be applied correctly, but our global SASS files seem discared (they are correctly included with v3.1.4, using the 'enableSassCompilation' and 'passthroughPaths' options)

akanix42 commented 5 years ago

I'll look into the global SASS files issue. I'm guessing the babel complaint is because I'm building the plugin using Meteor 1.7. If I build it with Meteor 1.8, it doesn't work at all: https://github.com/meteor/meteor/issues/10421

akanix42 commented 5 years ago

@yched I've fixed the issues I was experiencing with Meteor 1.8, please try nathantreid:css-modules@4.0.0.

yched commented 5 years ago

@nathantreid Yep, no more warnings on meteor run, and the app builds fine :+1:

Global SASS styles are still missing though. Do you need me to open a separate issue for that ?

akanix42 commented 5 years ago

@yched If you could that'd be great. If you can provide a reproduction repo, even better. If not I'll try just adding css modules plus scss to the basic meteor create app and see what that gets me.