ef4 / ember-browserify

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

"Cannot find module" when referencing a specific commit of a package #127

Closed YoranBrondsema closed 6 years ago

YoranBrondsema commented 6 years ago

I am trying to use ember-browserify with my own branch of mobiledoc-kit (see diff).

Importing the regular version published on NPM works fine. However, when I reference the specific commit on my own repository, I get the following error message when launching ember s:

$ ember s                                                                                                                     
Build Error (CoreObject)                                           

Cannot find module 'mobiledoc-kit' from '/home/yoran/Projects/YoranBrondsema/ember-browserify-bug-repro/tmp/stub_generator-output_path-mLymnepd.tmp'                                                                                                                           

Stack Trace and Error Report: /tmp/error.dump.8d73446add6ee7756f595ff508141b8e.log

Here is the error log: error.dump.8d73446add6ee7756f595ff508141b8e.log

I set up a reproduction repository. As you can see in the diff with a new Ember 2.18 installation, I just:

Any thoughts? Is it something in mobiledoc-kit? Or is it a limitation of browserify? Or something else?

Thanks!

ef4 commented 6 years ago

I think this is because mobiledoc-kit has a prepublish step that actually builds everything. Packages that do that generally don't work if you try to point directly at a git repo.

If you run the prepublish step yourself and then commit the results onto some branch, you can point at that branch and then it will probably work.

YoranBrondsema commented 6 years ago

Ah man, spot on @ef4. Removing /dist from the .gitignore, building and committing did the job. Thanks a lot!