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

fix(webpack): include hash in asset filenames so they do not conflict #27159

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Jul 26, 2024

Our assets are generated as flat assets in dist, which allows using assets from workspace libs. This prevents users from having different assets with the same filename (e.g. foo/image.png and bar/image.png). This will error out in the dev server with conflicting filenames.

We cannot use [path][name] because of assets that are outside of the app folder (e.g. ../../libs/ui/src/assets/image.png). Thus the best option is to include hash.

Note: Also re-enabled the e2e tests for react.test.ts file since it is now using Playwright instead of Cypress.

Current Behavior

Assets with the same filename will error in dev-mode.

Expected Behavior

Assets with the same filename works.

Related Issue(s)

Fixes #18272

@jaysoo jaysoo requested a review from a team as a code owner July 26, 2024 17:12
@jaysoo jaysoo requested a review from Coly010 July 26, 2024 17:12
Copy link

vercel bot commented Jul 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jul 26, 2024 7:54pm

@jaysoo jaysoo requested a review from a team as a code owner July 26, 2024 17:51
@jaysoo jaysoo enabled auto-merge (squash) July 26, 2024 19:23
@jaysoo jaysoo disabled auto-merge July 26, 2024 19:26
@ndcunningham ndcunningham merged commit 0710fea into master Jul 29, 2024
6 checks passed
@ndcunningham ndcunningham deleted the issue/18272 branch July 29, 2024 13:47
FrozenPandaz pushed a commit that referenced this pull request Jul 30, 2024
…#27159)

Our assets are generated as flat assets in dist, which allows using
assets from workspace libs. This prevents users from having different
assets with the same filename (e.g. `foo/image.png` and
`bar/image.png`). This will error out in the dev server with conflicting
filenames.

We cannot use `[path][name]` because of assets that are outside of the
app folder (e.g. `../../libs/ui/src/assets/image.png`). Thus the best
option is to include hash.

Note: Also re-enabled the e2e tests for `react.test.ts` file since it is
now using Playwright instead of Cypress.

## Current Behavior
Assets with the same filename will error in dev-mode.

## Expected Behavior
Assets with the same filename works.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #18272

(cherry picked from commit 0710fea)
Copy link

github-actions bot commented Aug 4, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation error (the same filename for multiple chunks) when import an image twice with the same filename
2 participants