@dcloudio/vue-cli-plugin-uni 2.0.2-alpha-4050720250320002 → 2.0.2-alpha-4060120250328001

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.
package/lib/mp/index.js CHANGED
@@ -314,8 +314,29 @@ ${globalEnv}.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
314
314
 
315
315
  webpackConfig.plugin('extract-css')
316
316
  .init((Plugin, args) => new Plugin({
317
- filename: '[name]' + styleExt
317
+ filename: '[name]' + styleExt,
318
+ // mini-css-extract-plugin 2.3.0 版本以上可用
319
+ // https://github.com/webpack-contrib/mini-css-extract-plugin/releases/tag/v2.3.0
320
+ runtime: false
318
321
  }))
322
+ // 去除 mini-css-extract-plugin 2.3.0 以下版本的 css runtime
323
+ // https://github.com/webpack-contrib/mini-css-extract-plugin/blob/e200b083e5a437026d6021262d4ac56088b39e65/src/index.js#L273
324
+ if (require('semver').lt(require('mini-css-extract-plugin/package.json').version, '2.3.0')) {
325
+ const pluginName = 'skip-mini-css-extract-runtime'
326
+ webpackConfig.plugin(pluginName).use(
327
+ class SkipMiniCssExtractRuntimePlugin {
328
+ apply (compiler) {
329
+ compiler.hooks.thisCompilation.tap(pluginName, compilation => {
330
+ const { mainTemplate } = compilation
331
+ const reg = /\/\/ mini-css-extract-plugin CSS loading[\s\S]*installedCssChunks\[chunkId\] = 0;\s*\}\)\);\s*\}/
332
+ mainTemplate.hooks.requireEnsure.tap(pluginName, (source, chunk) => {
333
+ return reg.test(source) ? source.replace(reg, '') : source
334
+ })
335
+ })
336
+ }
337
+ }
338
+ )
339
+ }
319
340
 
320
341
  if (
321
342
  process.env.NODE_ENV === 'production' &&
package/lib/options.js CHANGED
@@ -16,7 +16,9 @@ module.exports = function initOptions (options) {
16
16
  }
17
17
 
18
18
  // 增加 src/node_modules 解析
19
- options.transpileDependencies.push(pathToRegexp(path.resolve(process.env.UNI_INPUT_DIR, 'node_modules'), { start: true }))
19
+ options.transpileDependencies.push(pathToRegexp(path.resolve(process.env.UNI_INPUT_DIR, 'node_modules'), {
20
+ start: true
21
+ }))
20
22
  options.transpileDependencies.push('@dcloudio/uni-' + process.env.UNI_PLATFORM)
21
23
  options.transpileDependencies.push('@dcloudio/uni-i18n')
22
24
  options.transpileDependencies.push('@dcloudio/uni-stat')
@@ -70,11 +72,19 @@ module.exports = function initOptions (options) {
70
72
  const isScss = fs.existsSync(path.resolve(process.env.UNI_INPUT_DIR, 'uni.scss'))
71
73
  let sassData = isSass ? getPlatformSass() : getPlatformScss()
72
74
 
73
- if (isSass) {
74
- sassData = '@import "@/uni.sass"'
75
- } else if (isScss) {
76
- sassData = `${sassData}
77
- @import "@/uni.scss";`
75
+ if (process.env.UNI_SASS_IMPLEMENTATION_NAME === 'dart-sass') {
76
+ if (isSass) {
77
+ sassData = '@use "@/uni.sass" as *'
78
+ } else if (isScss) {
79
+ sassData = '@use "@/uni.scss" as *;'
80
+ }
81
+ } else {
82
+ if (isSass) {
83
+ sassData = '@import "@/uni.sass"'
84
+ } else if (isScss) {
85
+ sassData = `${sassData}
86
+ @import "@/uni.scss";`
87
+ }
78
88
  }
79
89
 
80
90
  if (!options.css.loaderOptions.sass.sassOptions) {
@@ -87,7 +97,8 @@ module.exports = function initOptions (options) {
87
97
  }
88
98
  options.css.loaderOptions.sass.prependData = sassData
89
99
  const userPostcssConfigPath = path.resolve(process.env.UNI_INPUT_DIR, 'postcss.config.js')
90
- const configPath = fs.existsSync(userPostcssConfigPath) ? userPostcssConfigPath : path.resolve(process.env.UNI_CLI_CONTEXT, 'postcss.config.js')
100
+ const configPath = fs.existsSync(userPostcssConfigPath) ? userPostcssConfigPath : path.resolve(process.env
101
+ .UNI_CLI_CONTEXT, 'postcss.config.js')
91
102
  if (webpack.version[0] > 4) {
92
103
  options.css.loaderOptions.postcss.postcssOptions.config = configPath
93
104
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.2-alpha-4050720250320002",
3
+ "version": "2.0.2-alpha-4060120250328001",
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-alpha-4050720250320002",
20
+ "@dcloudio/uni-stat": "^2.0.2-alpha-4060120250328001",
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": "8ab2a664ec51ec6176b8125cb9371b6c73441a58"
44
+ "gitHead": "c588ff9709aeeb559c7c5a2577ed24ebb5ec5719"
45
45
  }