Skip to content

Commit 1dabac0

Browse files
committed
build: build vercel
1 parent 8161ab6 commit 1dabac0

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

vercel.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
{ "key": "Cache-Control", "value": "no-cache, no-store, must-revalidate" }
1313
]
1414
},
15+
{
16+
"source": "/(.*)\\.js",
17+
"headers": [
18+
{ "key": "Access-Control-Allow-Origin", "value": "*" },
19+
{ "key": "Cross-Origin-Resource-Policy", "value": "cross-origin" }
20+
]
21+
},
1522
{
1623
"source": "/static/(.*)",
1724
"headers": [

webpack/webpack.prod.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ const regVendor = /[\\/]node_modules[\\/](axios|classnames|lodash)[\\/]/
3131

3232
const useSentryMap = process.env.SENTRY_SOURCE_MAP === 'map'
3333

34+
const mfeRole = (process.env.MFE_ROLE || '').toString().trim() // 'host' | 'remote' | ''
35+
const isMfeEnabled = mfeRole === 'host' || mfeRole === 'remote'
36+
3437
const optimizedAudioDir = path.resolve(__dirname, '../src/assets-optimized/audio')
3538
const optimizedVideoDir = path.resolve(__dirname, '../src/assets-optimized/video')
3639
const hasOptimizedAudio = fs.existsSync(optimizedAudioDir)
@@ -173,9 +176,11 @@ const prodWebpackConfig = merge(common, {
173176
// },
174177
},
175178
},
176-
runtimeChunk: {
177-
name: 'runtime',
178-
},
179+
// IMPORTANT for Module Federation:
180+
// When MFE is enabled (host/remote builds), keep runtime in the entry bundles.
181+
// Otherwise remoteEntry.js becomes a pure chunk that depends on runtime.*.js,
182+
// and hosts will fail with ScriptExternalLoadError ("Loading script failed").
183+
runtimeChunk: isMfeEnabled ? false : { name: 'runtime' },
179184
},
180185
performance: {
181186
hints: 'warning',

0 commit comments

Comments
 (0)