Skip to content

Commit 93150c5

Browse files
samuelmeuliiansu
authored andcommittedSep 24, 2019
Add "entrypoints" key to asset manifest (#7721)
1 parent 6f5221c commit 93150c5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed
 

‎packages/react-scripts/config/webpack.config.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -631,20 +631,27 @@ module.exports = function(webpackEnv) {
631631
filename: 'static/css/[name].[contenthash:8].css',
632632
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
633633
}),
634-
// Generate a manifest file which contains a mapping of all asset filenames
635-
// to their corresponding output file so that tools can pick it up without
636-
// having to parse `index.html`.
634+
// Generate an asset manifest file with the following content:
635+
// - "files" key: Mapping of all asset filenames to their corresponding
636+
// output file so that tools can pick it up without having to parse
637+
// `index.html`
638+
// - "entrypoints" key: Array of files which are included in `index.html`,
639+
// can be used to reconstruct the HTML if necessary
637640
new ManifestPlugin({
638641
fileName: 'asset-manifest.json',
639642
publicPath: publicPath,
640-
generate: (seed, files) => {
641-
const manifestFiles = files.reduce(function(manifest, file) {
643+
generate: (seed, files, entrypoints) => {
644+
const manifestFiles = files.reduce((manifest, file) => {
642645
manifest[file.name] = file.path;
643646
return manifest;
644647
}, seed);
648+
const entrypointFiles = entrypoints.main.filter(
649+
fileName => !fileName.endsWith('.map')
650+
);
645651

646652
return {
647653
files: manifestFiles,
654+
entrypoints: entrypointFiles,
648655
};
649656
},
650657
}),

‎packages/react-scripts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"url-loader": "2.1.0",
8080
"webpack": "4.40.2",
8181
"webpack-dev-server": "3.2.1",
82-
"webpack-manifest-plugin": "2.0.4",
82+
"webpack-manifest-plugin": "2.1.1",
8383
"workbox-webpack-plugin": "4.3.1"
8484
},
8585
"devDependencies": {

0 commit comments

Comments
 (0)