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

GitOrigin-RevId: 1092a1e368834c19d26bde2e62cbb97bcaf1f25c
This commit is contained in:
Alf Eaton
2023-07-17 11:05:00 +00:00
committed by Copybot
parent 03a25c6cf3
commit 96272b41b2
+11
View File
@@ -7,6 +7,17 @@ process.env.REACT_REFRESH = '1'
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, {
mode: 'development',