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

build/vega-datasets.min.js is now an iife, breaking require #391

Closed
mbostock opened this issue Oct 8, 2022 · 3 comments · Fixed by #393
Closed

build/vega-datasets.min.js is now an iife, breaking require #391

mbostock opened this issue Oct 8, 2022 · 3 comments · Fixed by #393

Comments

@mbostock
Copy link

mbostock commented Oct 8, 2022

I noticed that #388 changed build/vega-datasets.min.js to be an IIFE:

{
file: "build/vega-datasets.min.js",
format: "iife",
sourcemap: true,
name: "vegaDatasets",
plugins: [terser()],
},

Whereas build/vega-datasets.js is still a UMD:

{
file: "build/vega-datasets.js",
format: "umd",
sourcemap: true,
name: "vegaDatasets",
},

The problem is that require("vega-datasets") on Observable will use your unpkg/jsdelivr entry point which points to the IIFE, and thus errors:

"unpkg": "build/vega-datasets.min.js",
"jsdelivr": "build/vega-datasets.min.js",

You can see it breaking here:

https://observablehq.com/@vega/vega-lite-input-binding

If you want to drop UMD support, we could fix that notebook (and presumably others) by using ES import instead of require:

world = (await import('vega-datasets')).default['world-110m.json'].url

But if you are supporting IIFE, maybe it’s worth continuing to support UMD for backwards compatibility?

@domoritz
Copy link
Member

domoritz commented Oct 8, 2022

Thanks for the issue. I'll switch back to umd.

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

🚀 Issue was released in v2.5.2-next.0 🚀

@mbostock
Copy link
Author

mbostock commented Oct 9, 2022

Thanks for working on these issues Dominik!

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 a pull request may close this issue.

2 participants