fix(订阅式软件提供): venom_ui 产物内联 process.env.NODE_ENV,修复远端加载 process is not defined
lib 模式不自动替换 NODE_ENV,浏览器原生 import 时报错;build.define 强制按 production 常量内联
This commit is contained in:
1 parent
c50f3f0a55
commit
993d142bdd
1 file changed
+6
@@ -28,6 +28,12 @@ function InlineCssPlugin(): Plugin {
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue(), InlineCssPlugin()],
|
||||
// lib 模式不会自动替换 `process.env.NODE_ENV`(Vue/Element Plus 运行时里
|
||||
// 大量存在),浏览器原生 import 该 ES module 时会报 `process is not defined`。
|
||||
// 这里强制按生产常量内联,产物脱离 Node 环境可独立运行。
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
emptyOutDir: true,
|
||||
|
||||
Reference in new issue
Block a user