diff --git a/package.json b/package.json index a6bba295a3657c9d9d1060a5a56b0a701a04fc8b..81ac762a40c2b4951980bb95b9d1e9a1457257f6 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "semver": "^7.3.5", "ts-jest": "^27.0.3", "typescript": "4.6.4", - "vite": "^2.9.9", + "vite": "2.9.9", "vue": "3.2.37", "vue-router": "^4.0.15", "yorkie": "^2.0.0" diff --git a/packages/playground/ssr/package.json b/packages/playground/ssr/package.json index 9217edc59e3a75d29482e59d0c8afadaf442e3d5..ab55cdb8361a3c71cb4f8b3b59fc81f52b721ac9 100644 --- a/packages/playground/ssr/package.json +++ b/packages/playground/ssr/package.json @@ -21,6 +21,6 @@ "compression": "^1.7.4", "cypress": "^7.3.0", "serve-static": "^1.14.1", - "vite": "^2.9.9" + "vite": "2.9.9" } } diff --git a/packages/uni-app-plus/vite.config.ts b/packages/uni-app-plus/vite.config.ts index 934f49c9192153aa5361c2ca766f7537980a0140..2dbc7ec1abd45a17ed9691c9f74f10ae9b355f3f 100644 --- a/packages/uni-app-plus/vite.config.ts +++ b/packages/uni-app-plus/vite.config.ts @@ -123,6 +123,7 @@ export default defineConfig({ target: 'es2015', cssTarget, minify: true, + cssCodeSplit: false, lib: { name: 'uni-app-view', fileName: 'uni-app-view', diff --git a/packages/uni-app-vite/package.json b/packages/uni-app-vite/package.json index 8447af250be81313f0409b7b7d791ef4729c83bb..31510007ab62b6f965554cd103395f9a3fc75f46 100644 --- a/packages/uni-app-vite/package.json +++ b/packages/uni-app-vite/package.json @@ -40,7 +40,7 @@ "@vue/compiler-core": "3.2.37", "esbuild": "^0.14.27", "postcss": "^8.4.13", - "vite": "^2.9.9", + "vite": "2.9.9", "vue": "3.2.37" } } diff --git a/packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts b/packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts index ff91ccc1ddfbe3f77824b546bfcaf5fabc3d3f24..9fdb11e712faf39b11d2762ac1b98b4ddd79f648 100644 --- a/packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts +++ b/packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts @@ -561,15 +561,19 @@ async function compileCSS( ...postcssOptions, to: id, from: id, - map: { - inline: false, - annotation: false, - // postcss may return virtual files - // we cannot obtain content of them, so this needs to be enabled - sourcesContent: true, - // when "prev: preprocessorMap", the result map may include duplicate filename in `postcssResult.map.sources` - // prev: preprocessorMap, - }, + ...(devSourcemap + ? { + map: { + inline: false, + annotation: false, + // postcss may return virtual files + // we cannot obtain content of them, so this needs to be enabled + sourcesContent: true, + // when "prev: preprocessorMap", the result map may include duplicate filename in `postcssResult.map.sources` + // prev: preprocessorMap, + }, + } + : {}), }) // record CSS dependencies from @imports diff --git a/packages/vite-plugin-uni/package.json b/packages/vite-plugin-uni/package.json index 54992999b8895053c6fc2f0dc273faa71197a644..7f59cb1c06c9cc85208301073fab019606363952 100644 --- a/packages/vite-plugin-uni/package.json +++ b/packages/vite-plugin-uni/package.json @@ -53,11 +53,11 @@ "@types/sass": "^1.16.0", "@vue/babel-plugin-jsx": "^1.1.1", "chokidar": "^3.5.3", - "vite": "^2.9.9", + "vite": "2.9.9", "vue": "3.2.37" }, "peerDependencies": { - "vite": "^2.9.9" + "vite": "2.9.9" }, "uni-app": { "compilerVersion": "3.4.13" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index afa162c54589668fa0b8458b09824ca98e55f772..b6e9647e24669fa92ae35f7a66a7bb45ae2ba7e0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,7 +50,7 @@ importers: semver: ^7.3.5 ts-jest: ^27.0.3 typescript: 4.6.4 - vite: ^2.9.9 + vite: 2.9.9 vue: 3.2.37 vue-router: ^4.0.15 yorkie: ^2.0.0 @@ -115,7 +115,7 @@ importers: compression: ^1.7.4 cypress: ^7.3.0 serve-static: ^1.14.1 - vite: ^2.9.9 + vite: 2.9.9 vue: 3.2.37 vue-router: ^4.0.15 vuex: ^4.0.2 @@ -229,7 +229,7 @@ importers: picocolors: ^1.0.0 postcss: ^8.4.13 rollup: ^2.59.0 - vite: ^2.9.9 + vite: 2.9.9 vue: 3.2.37 dependencies: '@dcloudio/uni-cli-shared': link:../uni-cli-shared @@ -864,7 +864,7 @@ importers: hash-sum: ^2.0.0 jsonc-parser: ^3.0.0 picocolors: ^1.0.0 - vite: ^2.9.9 + vite: 2.9.9 vue: 3.2.37 dependencies: '@babel/core': 7.17.10