Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Apr 4, 2025

Description

vite bundles fdir transitively through @rollup/plugin-commonjs. fdir is cjs only and it uses require.resolve("picomatch"), but that's broken when bundled as esm.

I think rollup leaving require.resolve might be a bug (we should have createRequire banner?), but considering the story from #19487, we should avoid duplicating fdir, so I chose it unbundle though it's a bit weird since it's transitive dep.

Alternative is to unbundle @rollup/plugin-commonjs, but I think that would also cause more duplicate bundled/unbunled transitive dep (e.g. @rollup/pluginutils), so I didn't go with that for now.

@hi-ogawa hi-ogawa marked this pull request as ready for review April 4, 2025 08:04
@sapphi-red sapphi-red added p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release labels Apr 4, 2025
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another good reason to unbundle more dependencies

@patak-dev patak-dev merged commit 71227be into vitejs:main Apr 4, 2025
36 of 38 checks passed
moonlitusun pushed a commit to moonlitusun/vite that referenced this pull request May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using build.commonjsOptions.dynamicRequireTargets with glob throws an Error

3 participants