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

Bug in path generation for code-split import paths #662

Closed
ggoodman opened this issue Jan 12, 2021 · 1 comment
Closed

Bug in path generation for code-split import paths #662

ggoodman opened this issue Jan 12, 2021 · 1 comment

Comments

@ggoodman
Copy link

ggoodman commented Jan 12, 2021

Description

outputs[*].inputs[].path values appear to include invalid directory segments when shared chunks are produced by nested paths.

Reproduction

The following is a mini example that reproduces what I'm observing. It has a single entrypoint, with two chunks dynamically imported. The two lazy chunks and the main entrypoint all share a dependency on ./shared.js.

./index.js

import './shared';
import('./pages/about'), import('./pages/home');

React.createElement('div');

./shared.js:

//Side-effect
console.log('Shared');

./pages/about.js:

import '../shared';

./pages/home.js:

import '../shared';
esbuild \
  --bundle \
  --format=esm \
  --define:process.env.NODE_ENV=\"production\" \
  --platform=browser \
  --outdir=build \
  --metafile=build/meta.json \
  --splitting \
  index.js

The issue can be observed in the following screenshot. Note that two output chunks refer to the same filename (chunk.3D7RKSRB.js), however at different locations. You can also see in the file tree that this chunk is only at the root of the build folder and is not duplicated in the build/pages folder.

image

@evanw
Copy link
Owner

evanw commented Jan 13, 2021

Thanks for reporting this. The issue has been fixed and the fix will go out with the next release.

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

2 participants