From aff23726500de3050ba050bf0460eda2ed935b5e Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 11 Nov 2020 14:42:10 +0100 Subject: [PATCH] fix: configurable publicPath (closes #21) --- packages/nitro/src/config.ts | 2 ++ packages/nitro/src/rollup/config.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/nitro/src/config.ts b/packages/nitro/src/config.ts index 9dfc464512..d162134028 100644 --- a/packages/nitro/src/config.ts +++ b/packages/nitro/src/config.ts @@ -20,6 +20,7 @@ export interface SLSOptions { buildDir: string publicDir: string routerBase: string + publicPath: string fullStatic: boolean staticAssets: any @@ -63,6 +64,7 @@ export function getoptions (nuxt: SLSNuxt): SLSOptions { buildDir: nuxt.options.buildDir, publicDir: nuxt.options.generate.dir, routerBase: nuxt.options.router.base, + publicPath: nuxt.options.build.publicPath, fullStatic: nuxt.options.target === 'static' && !nuxt.options._legacyGenerate, staticAssets: nuxt.options.generate.staticAssets, diff --git a/packages/nitro/src/rollup/config.ts b/packages/nitro/src/rollup/config.ts index 186a8cf98a..e3309e35c4 100644 --- a/packages/nitro/src/rollup/config.ts +++ b/packages/nitro/src/rollup/config.ts @@ -77,6 +77,7 @@ export const getRollupConfig = (config: SLSOptions) => { 'process.env.NODE_ENV': '"production"', 'typeof window': '"undefined"', 'process.env.ROUTER_BASE': JSON.stringify(config.routerBase), + 'process.env.PUBLIC_PATH': JSON.stringify(config.publicPath), 'process.env.NUXT_STATIC_BASE': JSON.stringify(config.staticAssets.base), 'process.env.NUXT_STATIC_VERSION': JSON.stringify(config.staticAssets.version), // @ts-ignore