mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
fix(nuxt): support usage of std-env
in runtime code (#21372)
This commit is contained in:
parent
febf4b807d
commit
05b577e550
@ -408,7 +408,10 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
|
|||||||
options._modules.push(schemaModule)
|
options._modules.push(schemaModule)
|
||||||
options.modulesDir.push(resolve(options.workspaceDir, 'node_modules'))
|
options.modulesDir.push(resolve(options.workspaceDir, 'node_modules'))
|
||||||
options.modulesDir.push(resolve(pkgDir, 'node_modules'))
|
options.modulesDir.push(resolve(pkgDir, 'node_modules'))
|
||||||
options.build.transpile.push('@nuxt/ui-templates')
|
options.build.transpile.push(
|
||||||
|
'@nuxt/ui-templates', // this exposes vue SFCs
|
||||||
|
'std-env' // we need to statically replace process.env when used in runtime code
|
||||||
|
)
|
||||||
options.alias['vue-demi'] = resolve(options.appDir, 'compat/vue-demi')
|
options.alias['vue-demi'] = resolve(options.appDir, 'compat/vue-demi')
|
||||||
options.alias['@vue/composition-api'] = resolve(options.appDir, 'compat/capi')
|
options.alias['@vue/composition-api'] = resolve(options.appDir, 'compat/capi')
|
||||||
if (options.telemetry !== false && !process.env.NUXT_TELEMETRY_DISABLED) {
|
if (options.telemetry !== false && !process.env.NUXT_TELEMETRY_DISABLED) {
|
||||||
|
@ -37,6 +37,7 @@ export async function buildClient (ctx: ViteBuildContext) {
|
|||||||
devSourcemap: ctx.nuxt.options.sourcemap.client
|
devSourcemap: ctx.nuxt.options.sourcemap.client
|
||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(ctx.config.mode),
|
||||||
'process.server': false,
|
'process.server': false,
|
||||||
'process.client': true,
|
'process.client': true,
|
||||||
'module.hot': false
|
'module.hot': false
|
||||||
|
Loading…
Reference in New Issue
Block a user