@dcloudio/vue-cli-plugin-uni 2.0.2-3061420221215001 → 2.0.2-3061420221215003

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -398,23 +398,32 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
398
398
  })
399
399
  })
400
400
 
401
+ const alias = {
402
+ '@': path.resolve(process.env.UNI_INPUT_DIR),
403
+ './@': path.resolve(process.env
404
+ .UNI_INPUT_DIR), // css中的'@/static/logo.png'会被转换成'./@/static/logo.png'加载
405
+ vue$: getPlatformVue(vueOptions),
406
+ 'uni-pages': path.resolve(process.env.UNI_INPUT_DIR, 'pages.json'),
407
+ 'uni-stat-config': path.resolve(process.env.UNI_INPUT_DIR, 'pages.json') +
408
+ '?' +
409
+ JSON.stringify({
410
+ type: 'stat'
411
+ }),
412
+ vuex: require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vuex3'),
413
+ '@vue/composition-api': require.resolve('@dcloudio/vue-cli-plugin-uni/packages/@vue/composition-api')
414
+ }
415
+
416
+ if (process.env.UNI_PLATFORM.startsWith('mp')) {
417
+ const BabelRuntimeVersions = require('@babel/runtime/package.json').version.split('.')
418
+ if (BabelRuntimeVersions[0] === '7' && Number(BabelRuntimeVersions[1]) >= 18) {
419
+ alias['@babel/runtime/regenerator'] = require.resolve('@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator')
420
+ }
421
+ }
422
+
401
423
  return merge({
402
424
  devtool: false,
403
425
  resolve: {
404
- alias: {
405
- '@': path.resolve(process.env.UNI_INPUT_DIR),
406
- './@': path.resolve(process.env
407
- .UNI_INPUT_DIR), // css中的'@/static/logo.png'会被转换成'./@/static/logo.png'加载
408
- vue$: getPlatformVue(vueOptions),
409
- 'uni-pages': path.resolve(process.env.UNI_INPUT_DIR, 'pages.json'),
410
- 'uni-stat-config': path.resolve(process.env.UNI_INPUT_DIR, 'pages.json') +
411
- '?' +
412
- JSON.stringify({
413
- type: 'stat'
414
- }),
415
- vuex: require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vuex3'),
416
- '@vue/composition-api': require.resolve('@dcloudio/vue-cli-plugin-uni/packages/@vue/composition-api')
417
- },
426
+ alias,
418
427
  modules: [
419
428
  process.env.UNI_INPUT_DIR,
420
429
  path.resolve(process.env.UNI_INPUT_DIR, 'node_modules')
@@ -89,8 +89,8 @@ module.exports = function getSplitChunks () {
89
89
  }
90
90
  if (module.resource && (
91
91
  module.resource.indexOf('.vue') !== -1 ||
92
- module.resource.indexOf('.nvue') !== -1 ||
93
- normalizePath(module.resource).indexOf(mainPath) === 0 // main.js
92
+ module.resource.indexOf('.nvue') !== -1 ||
93
+ normalizePath(module.resource).indexOf(mainPath) === 0 // main.js
94
94
  )) {
95
95
  return false
96
96
  }
@@ -120,6 +120,15 @@ module.exports = function getSplitChunks () {
120
120
  }
121
121
  return true
122
122
  }
123
+
124
+ function getModuleChunks (module, chunks) {
125
+ // webpack5
126
+ if ('chunkGraph' in chunks) {
127
+ chunks = chunks.chunkGraph.getModuleChunks(module)
128
+ }
129
+ return chunks
130
+ }
131
+
123
132
  // TODO 独立分包
124
133
 
125
134
  const cacheGroups = {
@@ -130,6 +139,7 @@ module.exports = function getSplitChunks () {
130
139
  if (!baseTest(module)) {
131
140
  return false
132
141
  }
142
+ chunks = getModuleChunks(module, chunks)
133
143
  const matchSubPackages = findSubPackages(chunks)
134
144
  const matchSubPackagesCount = matchSubPackages.size
135
145
  const isMainPackage = ( // 非分包 或 两个及以上分包 或 主包内有使用
@@ -210,6 +220,7 @@ module.exports = function getSplitChunks () {
210
220
  if (!baseTest(module)) {
211
221
  return false
212
222
  }
223
+ chunks = getModuleChunks(module, chunks)
213
224
  const matchSubPackages = findSubPackages(chunks)
214
225
  if (
215
226
  matchSubPackages.size === 1 &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.2-3061420221215001",
3
+ "version": "2.0.2-3061420221215003",
4
4
  "description": "uni-app plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "author": "fxy060608",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@dcloudio/uni-stat": "^2.0.2-3061420221215001",
20
+ "@dcloudio/uni-stat": "^2.0.2-3061420221215003",
21
21
  "buffer-json": "^2.0.0",
22
22
  "clone-deep": "^4.0.1",
23
23
  "cross-env": "^5.2.0",
@@ -41,5 +41,5 @@
41
41
  "copy-webpack-plugin": ">=5",
42
42
  "postcss": ">=7"
43
43
  },
44
- "gitHead": "3332ef1b81e44bfdc1b4c44cc39417d916cf9de9"
44
+ "gitHead": "bea78ce365c9d3339edfec39820a67fd0dad924e"
45
45
  }
@@ -0,0 +1,4 @@
1
+ // TODO(Babel 8): Remove this file.
2
+
3
+ var runtime = require('@babel/runtime/helpers/regeneratorRuntime')()
4
+ module.exports = runtime