[webpack] Define a minimal set of entrypoints (#13688)

GitOrigin-RevId: 1092a1e368834c19d26bde2e62cbb97bcaf1f25c
This commit is contained in:
Alf Eaton 2023-07-11 14:38:09 +01:00 committed by Copybot
parent bbbf38d76b
commit 2665c5598b

View file

@ -7,6 +7,17 @@ process.env.REACT_REFRESH = '1'
const base = require('./webpack.config') const base = require('./webpack.config')
// if WEBPACK_ENTRYPOINTS is defined, remove any entrypoints that aren't included
if (process.env.WEBPACK_ENTRYPOINTS) {
const entrypoints = new Set(process.env.WEBPACK_ENTRYPOINTS.split(/\s*,\s*/))
console.log(`Building entrypoints ${[...entrypoints].join(',')}`)
for (const entrypoint in base.entry) {
if (!entrypoints.has(entrypoint)) {
delete base.entry[entrypoint]
}
}
}
module.exports = merge(base, { module.exports = merge(base, {
mode: 'development', mode: 'development',