How to load babel-plugins for a meteor package?

If it is, how is it possible to choose a babel plugin which can compile the code of my meteor package?

The thought came out of the idea of rewriting the package meteor-coverage to use the babel plugin istanbul to record the code-coverage. This would render quite some complex, hacky code superfluous and would allow us to be able to cover dynamically imported files (https://github.com/serut/meteor-coverage/issues/63). Here’s the link for the pull-request: https://github.com/serut/meteor-coverage/pull/73

The only downside of this approach is that we wouldn’t be able anymore to get the code-coverage of meteor-packages because I would have to add the plugin istanbul to the babel-command compiling the code of the package. Anyone here who has an idea of what could help?

I already tried registering the plugin in a .babelrc or package.json file which either is located in the folder of the meteor-package or the meteor application I’m trying to run this in.

If you want to play with it yourself, you can take this folder of the repo as starting point: https://github.com/SimonSimCity/meteor-coverage-app-exemple/tree/istanbul-babel-meteor-plugins/bare-exemple

I could also ask for baking it into the core, like the compilation of TypeScript: https://github.com/meteor/babel/blob/master/options.js#L120 or maybe do something to this repo https://github.com/meteor/babel-preset-meteor

Would be glad for any hint.

1 Like

Would be nice to get a public statement of someone knowing the meteor build tools in depth … e.g. @benjamn - you’re the first one coming up to my mind because I see you working a lot on the build tools :slight_smile:

A simple “no, it’s not possbile yet” would already be enough for me to create a feature-request on https://github.com/meteor/meteor-feature-requests and see if I can implement something. A hint where to start would be like the creme on a delicious cake :cake: