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

Ensure chunk filenames are consistent for long-term caching #548

Closed

Conversation

davidtaylorhq
Copy link

Per https://webpack.js.org/configuration/output/#template-strings, contenthash is based on the final content of the chunk file. Given the same file contents, the filename is guaranteed to be the same.

Resolves #519

Per https://webpack.js.org/configuration/output/#template-strings, `contenthash` is based on the final content of the chunk file. Given the same file contents, the filename is guaranteed to be the same.

Resolves embroider-build#519
davidtaylorhq added a commit to discourse/discourse that referenced this pull request Nov 7, 2022
This commit works around a couple of issues in `ember-auto-import` which were causing non-deterministic chunk filenames and content. Deterministic output should improve cache-reusability across deploys.

Refs:
embroider-build/ember-auto-import#519
embroider-build/ember-auto-import#548
embroider-build/ember-auto-import#478
davidtaylorhq added a commit to discourse/discourse that referenced this pull request Nov 7, 2022
This commit works around a couple of issues in `ember-auto-import` which were causing non-deterministic chunk filenames and content. Deterministic output should improve cache-reusability across deploys.

Refs:
embroider-build/ember-auto-import#519
embroider-build/ember-auto-import#548
embroider-build/ember-auto-import#478
@ef4
Copy link
Collaborator

ef4 commented Nov 7, 2022

Thanks. Since I see you've already tried this in discourse, can you check if there's any impact on the development-time rebuild performance?

Just asking because if it turns out to be more expensive, we can use it for prod but not dev. If the cost doesn't change, this PR will be fine as is and we can just always use it.

@davidtaylorhq
Copy link
Author

Thanks for taking a look @ef4

We didn't notice any performance change, but I haven't done any statistically-significant measurements. I did note that Webpack only enables realContentHash by default in production mode, which should help dev performance.

That said, after some more experimenting, I don't think this change is sufficient by itself. I've expanded a little in #519 (comment). We've ended up disabling auto-import sourcemaps in production for now to improve cross-build caching.

I'm hopeful that #479 will help with the problem we're seeing. I think removing the ephemeral paths like .../broccoli-58592ChasS63D8jsg/cache-294-webpack_bundler_ember_auto_import_webpack/... from the sourcemaps should help with hash consistency across builds.

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 this pull request may close these issues.

Chunks changing content when updating Webpack?
2 participants