Closed RobbieTheWagner closed 6 years ago
What do people think about potentially talking about rollup or something, similar to this https://github.com/cafreeman/ember-lodash-fp/pull/1? I know sometimes there are gotchas when you have an npm library and it's not nicely bundled up for you in a dist, and this could potentially allow you to still work with those libs. I don't know a ton about it myself though.
What do people think about potentially talking about rollup
I think what we should do is mention solutions for all existing module types:
app.import()
+ vendor shimapp.import()
app.import()
+ transform@rwwagner90 Here are few resources,
app.import + vendor shim: https://github.com/mike-north/ember-materialize-shim/blob/master/vendor/materialize-shim.js https://github.com/mike-north/ember-materialize-shim/blob/master/index.js#L50
amd transform, https://github.com/Deveo/ember-drag-sort/blob/gen-0/ember-cli-build.js#L32
For cjs I've used robert's https://github.com/rwjblue/ember-cli-cjs-transform in the past but then again it helps when there's only one file
For es6 i recently used https://github.com/sandydoo/ember-cli-es6-transform on a project. If you look into its readme it explains how to create a bundle with rollup.
Here are few more useful resources, https://simplabs.com/blog/2017/02/13/npm-libs-in-ember-cli.html and https://github.com/asakusuma/ember-rollup. Also @Turbo87 wrote https://github.com/Turbo87/ember-cli-rollup.
I'd love if we had a more detailed guide. However, I recommend that we merge the improvements that have already been made, then iterate on the more involved stuff in a later PR.
@rwwagner90 let me know when it's in a state where you'd feel good about us merging it in. I'm assuming the WIP in the title means "not yet"
I spent many, many hours trying to get underscore, lodash-amd, and other common JS libraries out there that export named AMD to import correctly, but they never would. With that in mind, I removed that example, as others will likely hit the same issues. Would love for someone to help make this more foolproof and tell me how to make it work!
In the interest of incremental improvement, this is done for now, and ready to be reviewed and merged 👍
This will eventually resolve #2017, but doesn't quite solve it all just yet.