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,