I have this NPM package, (accounting-js) which provides both oldschool (UMD) as es6 module way of modules (if I get it correctly). If I do "import x from ‘accounting-js’, it will automatically get the UMD version instead of the ES6 version. The es6 version is pointed to in the packages’ package.json under “jsnext:main”. Is there a way to tell Meteor to use this one instead of the UMD? (Or shouldn’t I want that)…
1 Like
TL;DR;
Currently, there is both no advantage to this nor would it work in Meteor if it was possible.
Longer explanation:
- The Rollup bundler is encouraging
jsnext:main
but I don’t think any other bundler supports it (yet?) - webpack, browserfy, meteor. - i.e. Meteor bundles NPM packages “as is”, i.e., relies on the prior transpilation by the publisher.
- This raises the other issue, in that
jsnext:main
refers only to using ES6 modules, not any other ES6 features. It relies on node having every other required feature, but node doesn’t have everything we / many authors want yet, and clients / browsers definitely don’t.
These are definitely issues that need solving in the future, but I wouldn’t worry about them now.
Cool, good to know. Saves a lot of headaches
1 Like