ef4 / ember-browserify

ember-cli addon for easily loading CommonJS packages from npm via browserify.
MIT License
172 stars 28 forks source link

Fix all the things #100

Open stefanpenner opened 8 years ago

stefanpenner commented 8 years ago

TL;DR this opens support (improved support, not quite perfect) for add-on and nested add-on usage.

The aim is to mangle imports/exports such that, each browserify bundle will uniquely identify each module by version. The associated importing module will also refer to that version. This will in-theory allow duplicate versions to co-exist. We would prefer this not to work, but shrug.... πŸ”₯


stefanpenner commented 8 years ago

@nathanhammond the tests have been updated to work with some known add-on limitations. There still exist further issues, but this now works around a resolving bug in ember-cli. So it is at-least closing to possibly working.

stefanpenner commented 8 years ago

Im heading to a meeting, and wont be looking at this for the next hour or so. My latest changes have been updated.

Please review the new lib structure, especially how in-repo modules dependencies are setup. Including that they declare their dependency on ember-browserify itself (this way ember browserify atleast runs for them).

There are more issues yet, although this is getting closer...

nathanhammond commented 8 years ago

The next step on this, which I've started, is to switch to pushing a preprocessor into the parent addon and away from postprocessTree. See #109.

stefanpenner commented 8 years ago

Some notes: browserify/browserify.js are being written (i believe):

We most likely need to address:

Something to consider:

nathanhammond commented 8 years ago

Order of execution:

  1. dummy treeForAddon
  2. modern treeForAddon
  3. modern preprocessor
  4. outdated treeForAddon
  5. outdated preprocessor
  6. dummy treeForVendor
  7. modern treeForVendor
  8. outdated treeForVendor
  9. dummy preprocessor (app)
  10. dummy preprocessor (tests)

Can use treeForVendor to "correctly" provide Browserify modules for all things but the root. This will eliminate the need to use .import.

Looking into available workarounds for the root, whose preprocessors run far too late. Also investigating the degree of change to Ember CLI and risk in changing this behavior to match the nested story.