PERF: Ensure JS chunk content and filenames are deterministic (#18907)

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:
https://github.com/ef4/ember-auto-import/issues/519
https://github.com/ef4/ember-auto-import/pull/548
https://github.com/ef4/ember-auto-import/issues/478
This commit is contained in:
David Taylor 2022-11-07 12:43:49 +00:00 committed by GitHub
parent 091d83af60
commit 3673d3359c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,19 @@ module.exports = function (defaults) {
autoImport: {
forbidEval: true,
insertScriptsAt: "ember-auto-import-scripts",
webpack: {
output: {
// Workaround for https://github.com/ef4/ember-auto-import/issues/519
// Upstreamed in https://github.com/ef4/ember-auto-import/pull/548
filename: `chunk.[id].[contenthash].js`,
chunkFilename: `chunk.[id].[contenthash].js`,
},
optimization: {
// Workaround to provide deterministic chunk output
// See https://github.com/ef4/ember-auto-import/issues/478#issuecomment-1000526638
moduleIds: "size",
},
},
},
fingerprint: {
// Handled by Rails asset pipeline