Skip to content

Commit 7f7ebdc

Browse files
committed
wip(dom2): 移除 UNI_VUE_VAPOR 环境变量
1 parent 0b74708 commit 7f7ebdc

File tree

4 files changed

+4
-45
lines changed

4 files changed

+4
-45
lines changed

packages/uni-app-uts/src/plugins/js/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export function createUniAppJsEnginePlugin(
173173
insertBeforePlugin(uniAppJsPlugin(config), 'uni:app-main', config)
174174
// 如果开启了 vapor 模式,则禁用 vue 的 devtools,让 @vitejs/plugin-vue 不管是开发还是发行,均生成发行代码
175175
// 理论上非 vapor 也应该禁用,但为了不引发其他问题,暂时只禁用 vapor 模式
176-
if (isDom2 || process.env.UNI_VUE_VAPOR === 'true') {
176+
if (isDom2) {
177177
const plugin = config.plugins.find((p) => p.name === 'vite:vue')
178178
if (plugin?.api?.options) {
179179
plugin.api.options.devToolsEnabled = false

packages/uni-cli-shared/src/hbx/alias.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ export function initModuleAlias() {
1818
const libDir = path.resolve(__dirname, '../../lib')
1919
const compilerSfcPath = path.resolve(libDir, '@vue/compiler-sfc')
2020
const serverRendererPath = require.resolve('@vue/server-renderer')
21-
// TODO 临时开关启用vapor
22-
if (
23-
!process.env.UNI_VUE_VAPOR &&
24-
process.env.UNI_INPUT_DIR &&
25-
// 该代码执行较早,不能使用UNI_UTS_PLATFORM
26-
(process.env.UNI_PLATFORM === 'app-harmony' ||
27-
(process.env.UNI_PLATFORM === 'app' &&
28-
process.env.UNI_APP_PLATFORM === 'ios'))
29-
) {
30-
const vaporConfig = path.resolve(process.env.UNI_INPUT_DIR, '.vapor')
31-
if (fs.existsSync(vaporConfig)) {
32-
process.env.UNI_VUE_VAPOR = 'true'
33-
if (fs.readFileSync(vaporConfig, 'utf-8').trim() === '*') {
34-
process.env.UNI_VUE_VAPOR_ALL = 'true'
35-
}
36-
}
37-
}
3821

3922
if (process.env.UNI_APP_X_DOM2 === 'true') {
4023
if (
@@ -50,27 +33,7 @@ export function initModuleAlias() {
5033
}
5134
}
5235
}
53-
if (process.env.UNI_VUE_VAPOR === 'true') {
54-
const vuePkgs = [
55-
'@vue/compiler-core',
56-
'@vue/compiler-dom',
57-
'@vue/compiler-sfc',
58-
'@vue/compiler-ssr',
59-
'@vue/compiler-vapor',
60-
'@vue/server-renderer',
61-
'@vue/shared',
62-
]
63-
vuePkgs.forEach((pkg) => {
64-
moduleAlias.addAlias(
65-
pkg,
66-
path.resolve(libDir, 'vapor', '@vue', pkg.split('/').pop()!)
67-
)
68-
})
69-
moduleAlias.addAlias(
70-
'@vitejs/plugin-vue',
71-
path.resolve(libDir, 'vapor', '@vitejs', 'plugin-vue')
72-
)
73-
} else if (process.env.UNI_APP_X_DOM2 === 'true') {
36+
if (process.env.UNI_APP_X_DOM2 === 'true') {
7437
const vuePkgs = [
7538
'@vue/compiler-core',
7639
'@vue/compiler-dom',

packages/uni-cli-shared/src/vite/plugins/uts/uvue.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ export function uniUTSUVueJavaScriptPlugin(options = {}): Plugin {
2626
return {
2727
code: code.replace(/<script([^>]*)>/gi, (match, attributes) => {
2828
let vapor = false
29-
if (
30-
process.env.UNI_VUE_VAPOR_ALL === 'true' ||
31-
process.env.UNI_APP_X_DOM2 === 'true'
32-
) {
29+
if (process.env.UNI_APP_X_DOM2 === 'true') {
3330
if (attributes.includes('setup') && !attributes.includes('vapor')) {
3431
vapor = true
3532
}

packages/vite-plugin-uni/src/vue/options.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ export function initPluginVueOptions(
211211
compilerOptions.nodeTransforms.push(
212212
...getBaseNodeTransforms(
213213
options.base,
214-
process.env.UNI_VUE_VAPOR === 'true' ||
215-
process.env.UNI_APP_X_DOM2 === 'true'
214+
process.env.UNI_APP_X_DOM2 === 'true'
216215
? createResolveStaticAsset(options.inputDir)
217216
: undefined
218217
)

0 commit comments

Comments
 (0)