Hello one and all
I've installed and begun playing around with laravel mix. The only issue I've run into is mix.babel()
I have the following line in webpack.mix.js
mix.babel('js/app.js', 'js/compiled.js')
I get the following error in the console
"use strict";var _SoundCloudSetup=require("./lib/SoundCloudSetup.js");....
compiled.js:1 Uncaught ReferenceError: require is not defined
at compiled.js:1
(anonymous) @ compiled.js:1
1) can I use a .babelrc file to configure babel? if so should I save it to the js root or the project root?
2) is there a clear way to configure babel in the style of a .babelrc file but within webpack.mix.js
Babel just converts ES2015 code to vanilla JS. But you're importing modules there, so it's squawking. You should use mix.js() if you need modules.
Thanks for getting back to me Jeffery
I ended up having to remove all the es6 code from my app. After trying a bunch of different mix configurations I couldn't get my code to work in Edge or ie11.
I wonder, should I have compiled the js modules with mix.js() and then run the complied.js file through mix.babel()?
All that being said, I want you to know that we all love Laravel, Laracasts and all the work you and Taylor do. Thanks for all your help and attentiveness
-Noah
On Tuesday, March 21, 2017 1:14 PM, Jeffrey Way <[email protected]> wrote:
Babel just converts ES2015 code to vanilla JS. But you're importing modules there, so it's squawking. You should use mix.js() if you need modules.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Did you ever figure out how you'd you pass things from mix.js to mix.babel? I'm in a similar boat.
.js('in.js', 'out.es6.js')
.babel('out.es6.js', 'out.js');
^ Works .. okay.. but very temperamental
/push
This still seems to be a problem! Is there any better workaround than https://github.com/JeffreyWay/laravel-mix/issues/593#issuecomment-297010327?
Most helpful comment
Did you ever figure out how you'd you pass things from mix.js to mix.babel? I'm in a similar boat.
^ Works .. okay.. but very temperamental