Repository navigation
es2015-in-modules support, useful for Angular (and more) - #85
kylecordes wants to merge 5 commits into
Conversation
Update various dependencies - avoid errors with Node 7, keep up with the ecosystem.
The code appeared to follow the syntax rule in most cases; add it to the lintrc and follow it throughout.
(as used in recent packages includes Angular - perhaps on the way to broader use)
|
Travis doesn't build node 0.12 anymore, but also doesn't have node 7 ready yet. |
|
@Rich-Harris What do you think of this? Could it be merged? |
|
Thanks for the PR. Is anybody doing this ( |
|
There is discussion over at RxJS of shipping ES2015-in-ES2015 modules, and I suspect that if that happens they will use the same es2015 field to point to them. I have not seen any alternatives proposed for a field for this purpose, and given the benefits of ES2015-in-ES2015 modules I hope we see adoption escalate. So this perhaps a nascent community convention? To keep the number of different plug-ins a person must find down, I thought about not adding an explicit es2015 flag, rather having the user configure an array of keys they would like searched in what order. A user could specify packageMainField: ['es2015', 'module', 'main'] or whatever other subset, combination, or order they need. I think the Webpack equivalent to rollup-plugin-node-resolve does something like this. Downside:
Upsides:
I'm happy to go any of these directions though. Keep it as it is here? Publish this instead as rollup-plugin-node-resolve-es2015? Switch to the packageMainField array idea? |
|
I think we should do the same as webpack and add customizable entry points. |
This is the nub of the issue — I would consider that a downside, not an upside! The thing is, I've seen how this story ends — with lots of confusion over which thing does what, and what practices should be considered 'best'. I believe that things like But the plugin API was designed to give this sort of freedom to people who need it, so to that end I think this would be best done as a separate Angular/RxJS-specific plugin. If it does end up being adopted more widely, it would be appropriate to revisit this. Hope that explains my stance, and that this doesn't just come across as me being awkward! 😀 |
|
Rich - got it, the plan is to make es2015 available on a secondary plugin, and reserve this primary plugin for the NPM package features that are either already official or have wide community support. In keeping with that, I think it's better to meet this (temporary?) pkg:es2015 need with a plugin that can be configured to grab pkg:es2016, rather than one that has pkg:es2015 on its feature list per se. I'm thinking of a name like rollup-plugin-node-resolve-adhoc. Or -experimental. Where should such a plugin exist?
|
|
(Actually, naming it -angular might help discoverability.) |
|
Yeah, calling it something with |
|
I have published it, with the -angular name as @Rich-Harris recommended: I linked it in the Wiki: (I'll close this PR, since things are likely to change in various chaotic ways between now and when a way of saying es2015-in-es2015 is settled as official.) |
Update dependencies so it will build/test on Node 7.
Lint cleanup
Refactor to make it easier to change the list/order of "what kind of module do you want?"
Add support for options.es2015, which is a hopefully-emerging way to say "here is es2015 code in es2015 modules". This is the format for optimal downstream tree-shaking etc with rollup and similar tools.
Useful now, to start working with Angular 4 rc.1 sitting there with es2015-code-in-es2015-modules code shipping.