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

require of a missing iterator.js file breaks builds #780

Closed
hukka opened this issue Nov 1, 2021 · 19 comments · Fixed by #800
Closed

require of a missing iterator.js file breaks builds #780

hukka opened this issue Nov 1, 2021 · 19 comments · Fixed by #800

Comments

@hukka
Copy link

hukka commented Nov 1, 2021

https://unpkg.com/browse/vega-embed@6.20.0/build/vega-embed.js has a line require('./iterator.js')(Yallist$1); which breaks some build systems due to that file missing from the package https://unpkg.com/browse/vega-embed@6.20.0/build/.

In the previous version (https://unpkg.com/browse/vega-embed@6.19.1/build/vega-embed.js) the iterator wasn't created with a require, but as an inlined function. There's no reference to iterator in the source code, however, so I suppose this comes from some other package, or the packaging tool?

@domoritz
Copy link
Member

domoritz commented Nov 2, 2021

Related issue: facebook/react#19756

Looks like something coming from babel.

@domoritz
Copy link
Member

domoritz commented Nov 4, 2021

I'm not sure why it's happening but I also wonder why your bundler is picking up the compiled file instead of https://unpkg.com/browse/vega-embed@6.20.0/build/vega-embed.module.js. Do you have any ideas about these two questions?

@domoritz domoritz added the bug label Nov 4, 2021
@hukka
Copy link
Author

hukka commented Nov 4, 2021

No idea on why, but the bundler certainly has options to pick the ESM version. Just wanted to give a heads up that the UMD release is broken.

@domoritz
Copy link
Member

domoritz commented Nov 4, 2021

Thanks for the heads up. Hopefully, that doesn't affect too many people since the ESM version is what bundlers should use and the bundles are more intended for direct use in browsers.

@peterspliid
Copy link

We're affected by this. We get the following error in the build pipline

Failed to compile.

/home/jenkins/workspace/.../node_modules/vega-embed/build/vega-embed.module.js
Module not found: Can't resolve './iterator.js' in '/home/jenkins/workspace/..../node_modules/vega-embed/build'

Do you know how to fix this?

@domoritz
Copy link
Member

Ahh, shoot. So the module file also has the broken import now.

@domoritz
Copy link
Member

domoritz commented Nov 16, 2021

@hukka
Copy link
Author

hukka commented Nov 16, 2021

It was introduced to the module build in https://unpkg.com/browse/vega-embed@6.20.1--canary.790.70fb595.0/build/vega-embed.module.js. But what changed between that and the previous canary (or between 6.20.0 and 6.20.1)…

@domoritz
Copy link
Member

Maybe it was the fix for #767.

@domoritz
Copy link
Member

Rollup doesn't seem to handle the require inside the try-catch: rollup/plugins#496

@hukka
Copy link
Author

hukka commented Nov 16, 2021

That would match the version, but difficult to see the connection. Yallist has been unchanged in yarn.lock since November last year, and is pulled as dependency of lru-cache which has been locked since December, and finally that is a dependency of semver which has been locked since March.

So I guess that the different way of importing is changing how the build tools behave.

@domoritz
Copy link
Member

domoritz commented Nov 16, 2021

I had to change the import for semver to work with the new versions of rollup. I guess something about the bundling process changed but it would be hard to track it down.

I think the solution is to either fix yallist to not use a require inside a try-catch or fix rollup.

Alternatively, we could try to switch to esbuild (#634) and see whether that fixes it.

Either way, I have to stop here and defer to rollup or yallist as the cause of this issue.

@lemmingapex
Copy link

This issues is also affecting us:

Module not found: Error: Can't resolve './iterator.js' in '.../node_modules/vega-embed/build'
 @ ./node_modules/vega-embed/build/vega-embed.module.js

@domoritz
Copy link
Member

I'm also seeing it in vega editor now. We should find a way to fix it. I'd appreciate any help/suggestions/ideas.

@ribeiromiranda
Copy link

ribeiromiranda commented Nov 25, 2021

This ./iterator.js file is from the yallist library on the https://github.com/isaacs/yallist/blob/master/package.json#L11 line.

The dependency of this yallist library follows the tree:
vega-embed -> semver -> lru-cache -> yallist

Maybe there is a problem with the build of package.

@github-actions
Copy link

🚀 Issue was released in v6.20.3-next.0 🚀

@domoritz
Copy link
Member

@aju @fcollonval any ideas for how we can solve this error here ?

@domoritz
Copy link
Member

Hmm, maybe bundledDependencies works.

@domoritz
Copy link
Member

Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants