@@ -10,6 +10,7 @@ const independentFilter = ({ independent }) => independent
10
10
const map2Root = ( { root } ) => root + '/'
11
11
const normalSubPackageRoots = subPkgsInfo . filter ( normalFilter ) . map ( map2Root )
12
12
const independentSubpackageRoots = subPkgsInfo . filter ( independentFilter ) . map ( map2Root )
13
+ const RequireAsyncDependency = require ( '@dcloudio/uni-mp-weixin/lib/support-require-async/RequireAsyncDependency' )
13
14
14
15
function createCacheGroups ( ) {
15
16
const cacheGroups = { }
@@ -87,6 +88,13 @@ module.exports = function getSplitChunks () {
87
88
if ( module . type === 'css/mini-extract' ) {
88
89
return false
89
90
}
91
+
92
+ // require.async()的模块不应该被分割
93
+ const reason = ( module && module . reasons && module . reasons [ 0 ] ) || { }
94
+ if ( reason . dependency instanceof RequireAsyncDependency ) {
95
+ return false
96
+ }
97
+
90
98
if ( module . resource && (
91
99
module . resource . indexOf ( '.vue' ) !== - 1 ||
92
100
module . resource . indexOf ( '.nvue' ) !== - 1 ||
@@ -139,6 +147,13 @@ module.exports = function getSplitChunks () {
139
147
if ( ! baseTest ( module ) ) {
140
148
return false
141
149
}
150
+
151
+ // require.async()的模块不应该被分割
152
+ const reason = ( module && module . reasons && module . reasons [ 0 ] ) || { }
153
+ if ( reason . dependency instanceof RequireAsyncDependency ) {
154
+ return false
155
+ }
156
+
142
157
chunks = getModuleChunks ( module , chunks )
143
158
const matchSubPackages = findSubPackages ( chunks )
144
159
const matchSubPackagesCount = matchSubPackages . size
@@ -220,6 +235,13 @@ module.exports = function getSplitChunks () {
220
235
if ( ! baseTest ( module ) ) {
221
236
return false
222
237
}
238
+
239
+ // require.async()的模块不应该被分割
240
+ const reason = ( module && module . reasons && module . reasons [ 0 ] ) || { }
241
+ if ( reason . dependency instanceof RequireAsyncDependency ) {
242
+ return false
243
+ }
244
+
223
245
chunks = getModuleChunks ( module , chunks )
224
246
const matchSubPackages = findSubPackages ( chunks )
225
247
if (
0 commit comments