mantra-sample-blog-app icon indicating copy to clipboard operation
mantra-sample-blog-app copied to clipboard

babel-root-slash-import breaks Meteor build

Open gadicc opened this issue 8 years ago • 6 comments

The latest version of meteor-react-hotloader introduces .babelrc support. But the babel-root-slash-import plugin breaks the Meteor build process, I get an error like:

 Error: Cannot find module '/home/dragon/www/tmp/mantra-sample-blog-app/lib/collections'
     at require (/home/dragon/www/tmp/mantra-sample-blog-app/.meteor/local/build/programs/server/packages/modules-runtime.js:95:19)
     at meteorInstall.server.configs.initial_adds.js (server/configs/initial_adds.js:3:16)
     at fileEvaluate (/home/dragon/www/tmp/mantra-sample-blog-app/.meteor/local/build/programs/server/packages/modules-runtime.js:158:9)
     at require (/home/dragon/www/tmp/mantra-sample-blog-app/.meteor/local/build/programs/server/packages/modules-runtime.js:92:16)
     at /home/dragon/www/tmp/mantra-sample-blog-app/.meteor/local/build/programs/server/app/app.js:269:1
     at /home/dragon/www/tmp/mantra-sample-blog-app/.meteor/local/build/programs/server/boot.js:281:10
     at Array.forEach (native)
     at Function._.each._.forEach (/home/dragon/.meteor/packages/meteor-tool/.1.2.4-rc.2.17279bz++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
     at /home/dragon/www/tmp/mantra-sample-blog-app/.meteor/local/build/programs/server/boot.js:133:5

I guess because this is emulating Meteor's behaviour outside of Meteor but inside of Meteor it overrides / breaks it :) ~~Not sure if this has been an issue with webpack:webpack too?~~ But inevitably Meteor will support .babelrc in post-1.3 anyway.

Hope this is the right place for this issue (the repo has issues disabled, but this is mostly about using it inside of Meteor which isn't it's original use case). Not sure how you'd want to best handle this case.

gadicc avatar Mar 18 '16 13:03 gadicc

I'm facing similar issue several days ago. But it seems MDG disable .babelrc support in beta.12.

But the babel-root-slash-import works fine for webpack:webpack package. You can check my ongoing project: https://github.com/ops-class/test161-web-ui/blob/master/app/package.json#L38

xcv58 avatar Mar 18 '16 14:03 xcv58

Ah oops, actually, I guess it works in webpack:webpack because Meteor's not building it there :> Yeah, official .babelrc was disabled but it will be back post-1.3 and then this will be an issue again with official Meteor. In the meantime, react-meteor-hotloader now re-introduces some better integrated .babelrc support usable today in 1.3-rc.2 (with the intention of submitting as a PR back to core).

gadicc avatar Mar 18 '16 14:03 gadicc

Sure, the webpack:webpack takes over the building process. So it's fine.

It's an issue when Meteor enables .babelrc again.

xcv58 avatar Mar 18 '16 14:03 xcv58

I think if it's the time for .babelrc in meteor, we can try to use this only when mantra running tests rather doing this in the .babelrc.

arunoda avatar Mar 24 '16 05:03 arunoda

Now if you update to the latest stable version of meteor, this issue will come. Ref : https://forums.meteor.com/t/1-3-3-imports-breaking/24890

THPubs avatar Jun 22 '16 08:06 THPubs

Guys, I just introduce a new version of babel-root-slash-import which works properly inside Meteor.

I've updated this repo to use it.

arunoda avatar Jun 23 '16 03:06 arunoda