feat: support staticAssetsBase

This commit is contained in:
Pooya Parsa 2020-11-05 19:53:17 +01:00
parent 005421e04d
commit 415db060b0
2 changed files with 14 additions and 1 deletions

View File

@ -24,6 +24,13 @@ export interface SLSOptions {
analyze: boolean
minify: boolean
rollupConfig?: any
fullStatic: boolean,
staticAssets: {
base: string
versionBase: string
dir: string
version: string
}
hooks: { [key: string]: any } // TODO: export from hookable
}
@ -34,6 +41,9 @@ export function getoptions (nuxtOptions: NuxtOptions): SLSOptions {
rootDir: nuxtOptions.rootDir,
buildDir: nuxtOptions.buildDir,
publicDir: nuxtOptions.generate.dir,
fullStatic: nuxtOptions.target === 'static' && !nuxtOptions._legacyGenerate,
// @ts-ignore
staticAssets: nuxtOptions.generate.staticAssets,
outName: 'server.js',
templates: [],
static: [],

View File

@ -72,7 +72,10 @@ export const getRollupConfig = (config: SLSOptions) => {
options.plugins.push(replace({
values: {
'process.env.NODE_ENV': '"production"',
'typeof window': '"undefined"'
'typeof window': '"undefined"',
'process.env.NUXT_STATIC_BASE': JSON.stringify(config.staticAssets.base),
'process.env.NUXT_STATIC_VERSION': JSON.stringify(config.staticAssets.version),
'process.env.NUXT_FULL_STATIC': config.fullStatic
}
}))