From e9ced7f432340059c4893a9349fb7c5f2361b5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=87=E9=A3=8E?= Date: Tue, 10 Oct 2023 10:13:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=98=E5=8E=9Fg=5FgetAssets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/preset-umi/templates/server.tpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/preset-umi/templates/server.tpl b/packages/preset-umi/templates/server.tpl index b98d54a5ed3f..44e6a28d48f0 100644 --- a/packages/preset-umi/templates/server.tpl +++ b/packages/preset-umi/templates/server.tpl @@ -35,6 +35,12 @@ export function createHistory(opts) { return createClientHistory(opts); } +// TODO: remove global variable +global.g_getAssets = (fileName) => { + let m = typeof manifest === 'function' ? manifest() : manifest; + return m.assets[fileName]; +}; +const manifest = {{{ env }}} === 'development' ? getManifest : getManifest(); const createOpts = { routesWithServerLoader, PluginManager,