mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
feat: support runtimeConfig (closes #43)
This commit is contained in:
parent
5783abdb52
commit
ca015deda6
@ -46,6 +46,7 @@ export interface SigmaContext {
|
|||||||
isStatic: boolean
|
isStatic: boolean
|
||||||
fullStatic: boolean
|
fullStatic: boolean
|
||||||
staticAssets: any
|
staticAssets: any
|
||||||
|
runtimeConfig: { public: any, private: any }
|
||||||
}
|
}
|
||||||
_internal: {
|
_internal: {
|
||||||
runtimeDir: string
|
runtimeDir: string
|
||||||
@ -93,7 +94,11 @@ export function getsigmaContext (nuxtOptions: NuxtOptions, input: SigmaInput): S
|
|||||||
isStatic: nuxtOptions.target === 'static' && !nuxtOptions.dev,
|
isStatic: nuxtOptions.target === 'static' && !nuxtOptions.dev,
|
||||||
fullStatic: nuxtOptions.target === 'static' && !nuxtOptions._legacyGenerate,
|
fullStatic: nuxtOptions.target === 'static' && !nuxtOptions._legacyGenerate,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
staticAssets: nuxtOptions.generate.staticAssets
|
staticAssets: nuxtOptions.generate.staticAssets,
|
||||||
|
runtimeConfig: {
|
||||||
|
public: nuxtOptions.publicRuntimeConfig,
|
||||||
|
private: nuxtOptions.privateRuntimeConfig
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_internal: {
|
_internal: {
|
||||||
runtimeDir: resolve(__dirname, '../runtime'),
|
runtimeDir: resolve(__dirname, '../runtime'),
|
||||||
|
@ -105,7 +105,8 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {
|
|||||||
'process.env.NUXT_STATIC_BASE': JSON.stringify(sigmaContext._nuxt.staticAssets.base),
|
'process.env.NUXT_STATIC_BASE': JSON.stringify(sigmaContext._nuxt.staticAssets.base),
|
||||||
'process.env.NUXT_STATIC_VERSION': JSON.stringify(sigmaContext._nuxt.staticAssets.version),
|
'process.env.NUXT_STATIC_VERSION': JSON.stringify(sigmaContext._nuxt.staticAssets.version),
|
||||||
'process.env.NUXT_FULL_STATIC': sigmaContext._nuxt.fullStatic as unknown as string,
|
'process.env.NUXT_FULL_STATIC': sigmaContext._nuxt.fullStatic as unknown as string,
|
||||||
'process.env.SIGMA_PRESET': JSON.stringify(sigmaContext.preset)
|
'process.env.SIGMA_PRESET': JSON.stringify(sigmaContext.preset),
|
||||||
|
'process.env.RUNTIME_CONFIG': JSON.stringify(sigmaContext._nuxt.runtimeConfig)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user