Skip to content

Commit

Permalink
fix: 修复生产模式无法初始化的问题
Browse files Browse the repository at this point in the history
如果按照 fa05cb8 进行代码分割,以下的包无法被正常初始化:

vue-reactivity.3e8cd67e.js:5  Uncaught ReferenceError: Cannot access 'y' before initialization
    at vue-reactivity.3e8cd67e.js:5:3472

Uncaught ReferenceError: Cannot access 'O' before initialization
    at Qr (fluentui.3e1d6240.js:1:569)
    at ms2.6240dc00.js:193:2171

故将 `@vue/runtime-core` 和 `@vue/reactivity` 缝合在一起,`@microsoft/
fast-foundation` 和 `@fluentui/web-components` 缝合在一起,以防在生
产环境下出现上述错误。

Signed-off-by: crrashh1542 <[email protected]>
  • Loading branch information
crrashh1542 committed Jun 9, 2024
1 parent 60ac9f6 commit 2087d9b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,18 @@ export default defineConfig({
entryFileNames: '_wu/[name].[hash].js',
minifyInternalExports: true,
manualChunks(id) {
if(id.includes('@vue/runtime-core')) {
if(id.includes('@vue')) {
return 'vendors/vue-runtime'
}
if(id.includes('@vue/reactivity')) {
return 'vendors/vue-reactivity'
}
if(id.includes('vue-router')) {
return 'vendors/router'
}
if(id.includes('@microsoft/fast-colors') ||
id.includes('@microsoft/fast-element')) {
return 'vendors/ms1'
return 'vendors/ms'
}
if(id.includes('@microsoft/fast-foundation')) {
return 'vendors/ms2'
}
if(id.includes('@fluentui/web-components')){
if(id.includes('@microsoft/fast-foundation') ||
id.includes('@fluentui/web-components')) {
return 'vendors/fluentui'
}
}
Expand Down

0 comments on commit 2087d9b

Please sign in to comment.