Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use with node_modules and commonjs requires #1773

Closed
supersteves opened this issue May 5, 2016 · 3 comments
Closed

Use with node_modules and commonjs requires #1773

supersteves opened this issue May 5, 2016 · 3 comments
Labels

Comments

@supersteves
Copy link
Contributor

I'm exploring using Closure Compiler with node_modules and have run into a couple of blocking issues:

  • Moocher dropping. All CJS modules are being considered moochers because they don't "provide" anything. I need moocher dropping in my codebase to avoid pulling in tons of unused files for compilation.
  • node_module path resolution. I'm happy to write my paths explicitly like require("react-bootstrap/lib/Action.js") but where the module I'm requiring itself requires e.g. "react" rather than "react/main.js", it's an error. For this I'd like to supply my own loader which implements node_modules rules and package json awareness.

As it stands I think I can only realistically use CJS requires (or ES6 imports) when importing my own code rather than complex pre-existing libraries.

@ChadKillingsworth
Copy link
Collaborator

Moocher dropping. All CJS modules are being considered moochers because they don't "provide" anything. I need moocher dropping in my codebase to avoid pulling in tons of unused files for compilation.

Not sure why you see this - this definitely isn't occurring in my code bases. Make sure you use the --process_common_js_modules flag.

As it stands I think I can only realistically use CJS requires (or ES6 imports) when importing my own code rather than complex pre-existing libraries.

This is currently true.

@ChadKillingsworth
Copy link
Collaborator

This is fixed by #2130 - use the --module_resolution=NODE flag.

@supersteves
Copy link
Contributor Author

Great! Thanks Chad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants