Meteor + ES6 + large external lib not happy - solutions

I have a meteor app that uses a rather large external library based on AMD. It all works currently. What I do is I have a grunt build step that builds the external library using “r” from require.js. So basically I typed grunt and it reads start.js which reads about 50 + js files and generates a file myMeteorProjectFolder/client/myLib.js. This all works

Now, I’d like to transition to ES6 so I added the ecamscript package as detailed in this blog post.

Unfortunately I ran into this bug which is apparently whatever meteor is using to do ecmascript is failing on large files. I thought meteor is using babel and if I use babel directly it has no problem compiling myMeteorProjectFolder/client/myLib.js.

In any case I’m looking for solutions. I can hack something together but before I do I thought I’d ask to see if people have better ideas.

My current idea is I’ll change my grunt build that is currently building myMeteorProjectFolder/client/myLib.js to instead just copy all the AMD modules into myMeteorProjectFolder/client/myLibFolder but while it’s copying them it will have to do some substitutions on the AMD parts like converting

define([deps...], function(args..) { }


define("moduleName", [deps...], function(args...) {}

so that I can actually use them in meteor without async loading them and without requirejs. In other words I’ll make my own simple define function that fixes up the deps at runtime.

The hope is that by copying the individual files in I can use the ecmascript package and it won’t barf and then I can start converted my code to ES6.

Is there some other solutions I should look into?