From fa3f62a00c9590a0612fb0a2165375f99d33beb8 Mon Sep 17 00:00:00 2001 From: Peach Date: Thu, 20 Oct 2022 16:26:45 +0800 Subject: [PATCH] feat(preset-built-in): add env to disable app runtime plugin (#9579) --- .../src/plugins/generateFiles/core/plugin.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/preset-built-in/src/plugins/generateFiles/core/plugin.ts b/packages/preset-built-in/src/plugins/generateFiles/core/plugin.ts index ac23b2f72368..1a580ce14dc3 100644 --- a/packages/preset-built-in/src/plugins/generateFiles/core/plugin.ts +++ b/packages/preset-built-in/src/plugins/generateFiles/core/plugin.ts @@ -24,11 +24,14 @@ export default function (api: IApi) { ], }); - const appRuntimeFilePath = getFile({ - base: paths.absSrcPath!, - fileNameWithoutExt: 'app', - type: 'javascript', - })?.path; + const appRuntimeFilePath = + process.env.RUNTIME_APP_JS !== 'none' + ? getFile({ + base: paths.absSrcPath!, + fileNameWithoutExt: 'app', + type: 'javascript', + })?.path + : undefined; const plugins = await api.applyPlugins({ key: 'addRuntimePlugin', type: api.ApplyPluginsType.add,