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

importing or requiring weback bundles from npm packages into another webpack bundle #2589

Closed
draisy opened this issue Jun 2, 2016 · 2 comments

Comments

@draisy
Copy link

draisy commented Jun 2, 2016

Hi,

I have an es6 module that I'm bundling with webpack and babel-loader, to be consumed by my project via npm. When I add the import (or require) statement to my project, the exports are always returned as an empty object. If I remove the webpack bundling from the module, and transpile with babel-cli only, the exported object is always imported correctly.

Is there an additional config that I need to add to my module to be able to consume the bundled file in another webpack bundle?

@agundermann
Copy link

As far as I know there are two options:

  1. Bundle your es6 module as a library. This way, you can require the bundle to get the exports of its entry module.
  2. Bundle your es6 module using the DLLPlugin. This allows you to require any of the contained modules, not just the entry module, but it might make it harder to use the module without webpack.

@draisy
Copy link
Author

draisy commented Jun 3, 2016

Thank you! Bundling as an output library resolved the issue for me.

@draisy draisy closed this as completed Jun 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants