mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #15514 from overleaf/jpa-single-webpack-runtime
[web] enable webpack option runtimeChunk=single in dev-env GitOrigin-RevId: 905b362496fc5df896632db920c91aee75c30b46
This commit is contained in:
@@ -171,8 +171,16 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
|
||||
return staticFilesBase + (webpackManifest[jsFile] || '/' + jsFile)
|
||||
}
|
||||
|
||||
let runtimeEmitted = false
|
||||
const runtimeChunk = webpackManifest['runtime.js']
|
||||
res.locals.entrypointScripts = function (entrypoint) {
|
||||
const chunks = getWebpackAssets(entrypoint, 'js')
|
||||
// Each "entrypoint" contains the runtime chunk as imports.
|
||||
// Loading the entrypoint twice results in broken execution.
|
||||
let chunks = getWebpackAssets(entrypoint, 'js')
|
||||
if (runtimeEmitted) {
|
||||
chunks = chunks.filter(chunk => chunk !== runtimeChunk)
|
||||
}
|
||||
runtimeEmitted = true
|
||||
return chunks.map(chunk => staticFilesBase + chunk)
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,8 @@ module.exports = merge(base, {
|
||||
},
|
||||
|
||||
optimization: {
|
||||
runtimeChunk: process.env.WEBPACK_RUNTIME_CHUNK || false,
|
||||
runtimeChunk: {
|
||||
name: 'runtime',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user