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

Webpack does not resolve module 'bubblechart' even if module was installed via npm #3

Open
rafaelpivato opened this issue Dec 2, 2015 · 5 comments

Comments

@rafaelpivato
Copy link

In order to use this as a module through npm, you need to manually build it before hand. Which means having things like grunt installed, even if you are relying on other build system like webpack, for instance.

The usual approach to this is build and publish minified and dist source code along with rest of code at GitHub.

@rafaelpivato
Copy link
Author

This was premature. I can see the files present at dist now. My issue resolving the module should have other reason. In case you are curious my real problem is this error output from a Webpack build:

Module not found: Error: Cannot resolve module 'bubblechart'

@rafaelpivato rafaelpivato changed the title Provide dist files with npm package and GitHub dist folder Webpack does not resolve module 'bubblechart' even if module was installed via npm Dec 2, 2015
@jondavidjohn
Copy link
Owner

Thanks! Back when this was originally built I did not do a good job of making it play well with module loaders. I would definitely accept a Pull Request to improve the module loader compatibility. 👍

@rafaelpivato
Copy link
Author

Adding main entry to package.json solved my issue. I think we could have that in master branch here.

...
"main": "./dist/bubblechart.js",
...

@jondavidjohn
Copy link
Owner

Right, but I think we also need to make sure it doesn't attach globally when required, but return the BubbleChart class.

It should only attach globally when not requiring via a module system. See this for example

@rafaelpivato
Copy link
Author

Excellent point 👍

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