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

Added webpack field for entry point to dist #68

Merged
merged 1 commit into from Dec 3, 2015
Merged

Conversation

mdtusz
Copy link
Contributor

@mdtusz mdtusz commented Dec 3, 2015

This won't break anything for people who have been using require('plotly.js/dist/plotly.min.js') because of how webpack resolves things.

@etpinard
Copy link
Contributor

etpinard commented Dec 3, 2015

Great. 💃

mdtusz added a commit that referenced this pull request Dec 3, 2015
Added webpack field for entry point to dist
@mdtusz mdtusz merged commit af28316 into master Dec 3, 2015
@mdtusz mdtusz deleted the webpack-entry branch December 3, 2015 17:37
@fhurta
Copy link
Contributor

fhurta commented Aug 25, 2016

I'd suggest the webpack entry in package.json would point to ./lib/index.js instead. When pointing to dist webpack produces this warning:

WARNING in ./~/plotly.js/dist/plotly.js Critical dependencies: 7:479-486 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results. @ ./~/plotly.js/dist/plotly.js 7:479-486

@mdtusz
Copy link
Contributor Author

mdtusz commented Aug 25, 2016

The issue with pointing at the ./lib/index.js is that we use the Browserify "glslify" transform to work on our gl components, so webpack users would have to use a more complex setup involving either transform-loader, or ify-loader (I had more success testing with ify-loader).

The reason we left webpack pointing to the built file is that it doesn't really matter. The output of webpack is seldom looked at, and typically will be minified anyways.

@etpinard
Copy link
Contributor

@fhurta good point. But, I'm not convinced making lib/index.js the webpack entry point would be better as it would require webpack users to add the ify-loader to their config (more info here).

So, what's better for the main webpack entry point? Webpack spitting out warnings or making users require some third-party module in order to bundle properly?

@fhurta
Copy link
Contributor

fhurta commented Aug 25, 2016

OK, then. Thanks for response.
However, FYI, I use webpack (1.13.1) and have nor transform-loader neither ify-loader installed and import (typescript's require) from lib.

@mdtusz
Copy link
Contributor Author

mdtusz commented Aug 25, 2016

Yep! That's precisely why we didn't point the webpack entry to the lib/index.js!

By using the built bundle, webpack users aren't required to have any extra dependencies. The browserify transforms do their thing on our end at build time when we create the file at dist/plotly.js.

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

Successfully merging this pull request may close these issues.

None yet

3 participants