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: remove content hash from chunk names #1575

Merged
merged 2 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/subapp-web/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ const utils = {
const entryPoints = assets.entryPoints[entryName];
assert(entryPoints, `subapp-web: no entry point found for ${name}`);

// without webpack optimization.runtimeChunk the entry point bundles are generated
// as <entryName>.bundle.js, like header.bundle.js
// but with runtimeChunk, the entry point are generated with hash
// as <hash>.<entryName>.js
// So check both cases.
const matchEntry = x => x === `${entryName}.bundle.js` || x.endsWith(`.${entryName}.js`);
//
// Normal entry output bundles are generated as <entryName>.bundle[.dev].js, like header.bundle.js
// See xarc-webpack/lib/partial/[output, dev]
// The plugin SplitChunksPlugin generate chunks with name as <entryName>.~<hash>.bundle[.dev].js
// See xarc-webpack/lib/partial/subapp-chunks.js
//
const matchEntry = x => x.startsWith(`${entryName}.bundle`) || x.startsWith(`${entryName}.~`);
// map all IDs to actual assets
const bundleAssets = entryPoints
.map(id => {
Expand Down
3 changes: 2 additions & 1 deletion packages/xarc-webpack/lib/partials/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ module.exports = function() {
devServer: devServerConfig,
output: {
publicPath: makePublicPath(),
filename: "[name].bundle.dev.js"
filename: "[name].bundle.dev.js",
chunkFilename: "[name].bundle.dev.js"
},
devtool: "inline-source-map",
// TODO: why is this here and duplicates what's in extract-style partial? This is causing
Expand Down
4 changes: 1 addition & 3 deletions packages/xarc-webpack/lib/partials/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ module.exports = () => ({
path: getOutputPath(),
pathinfo: inspectpack, // Enable path information for inspectpack
publicPath: "/js/",
chunkFilename: babel.hasMultiTargets
? `${babel.target}.[contenthash].[name].js`
: "[contenthash].[name].js",
chunkFilename: getOutputFilename(),
filename: getOutputFilename()
}
});
4 changes: 3 additions & 1 deletion packages/xarc-webpack/lib/partials/subapp-chunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ function hashChunks(mod, chunks, key) {
digest = hash.digest("hex");
splitMap[id] = digest;
}
return `${key}~${digest}`;
digest = digest.substr(-8);
// subapp-web/lib/util.js will try to match <entryName>.~ to detect subapp bundles
return `${key}.~${digest}`;
}

function makeConfig() {
Expand Down