Skip to content

Can't use any bundlers other than browserify #13

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

Closed
justinwoo opened this issue Nov 18, 2015 · 8 comments
Closed

Can't use any bundlers other than browserify #13

justinwoo opened this issue Nov 18, 2015 · 8 comments

Comments

@justinwoo
Copy link
Contributor

There are a host of issues that have been discussed on other projects with glslify locking down bundling to only browserify.

Shame since it looks like a normal module we can bundle with anything we want 😢

I don't know enough about this issue to propose a fix, but hopefully someone knows enough about this and make swapping out the browserify-specific easy.

@etpinard
Copy link
Contributor

plotly.js is a heavy user of browserify transforms, not just glslify. Adapting the build tasks to other build systems won't be easy.

May I ask, in what context are you trying to build plotly.js?

If you can't make the switch to browserify, maybe you should consider including plotly.js in a separate <script> tag than the rest of your code. Note that plotly.js exports the global Plotly.

I hope this helps.

@justinwoo
Copy link
Contributor Author

I'm using webpack, since I have a lot of other things (e.g. loaders for babel, Elm, SASS) that I use with it and make a lot of use of the features there. Besides existing webpack loader work, there's some personal preference and other reasons why I don't want to use browserify.

I also ran into a problem with trying to just bundle the dist build and conflicts with the global Plotly. It'd be nicer if we just had a UMD build or something, I think, but it's not a huge priority for me.

@Hypercubed
Copy link
Contributor

@justinwoo See #14, dist/plotly.js is UMD but broken ATM. Removing the last line allowed me to use the bundle with JSPM/SystemJS. Might also work for webpack.

@trebor
Copy link

trebor commented Nov 24, 2015

@Hypercubed, ya, as far as i can tell that last line (dist/plotly.js:83327) is the only thing that limits use with requirejs. with a shim, i get what appears to be a good plotly object. i get the nasty error though.

@Hypercubed
Copy link
Contributor

I'd also kindly suggest that d3 be removed from the bundle. I believe many of use will already have a copy of d3 installed, an additional copy in the bundle is redundant. Of course documentation would need to be clear that d3 should be added as a peer.

@etpinard
Copy link
Contributor

I'd also kindly suggest that d3 be removed from the bundle

This will not happen I'm afraid.

We chose to have an all-in-one bundle for simplicity and robustness (as d3 in notoriously bad at following semver).

Note that d3 is exported onto the Plotly object. I'd would recommend removing your <script src="d3"> tag and using Plotly.d3 instead d3 (or equivalently mapping window.d3 = Plotly.d3 after importing plotly.js).

@etpinard
Copy link
Contributor

Fixed in v1.1.0

See webpack example: https://gist.github.com/etpinard/f3d44dab330785368534

@mdtusz
Copy link
Contributor

mdtusz commented Dec 3, 2015

A webpack field has been added to the package.json so that you can use plotly.js with webpack as normal. You will see a warning when webpack builds your bundle because it is using the distribution version of plotly.js, but this is unavoidable at the moment.

@mdtusz mdtusz closed this as completed Dec 7, 2015
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

5 participants