feat: use runInNewContext: true for nuxt dev (#4508)

This commit is contained in:
Pooya Parsa 2018-12-10 01:07:36 +03:30 committed by Xin Du (Clark)
parent 58569cef18
commit 1162f2ddc1
3 changed files with 8 additions and 2 deletions

View File

@ -3,7 +3,8 @@
export default () => ({
bundleRenderer: {
shouldPrefetch: () => false,
shouldPreload: (fileWithoutQuery, asType) => ['script', 'style'].includes(asType)
shouldPreload: (fileWithoutQuery, asType) => ['script', 'style'].includes(asType),
runInNewContext: undefined
},
resourceHints: true,
ssr: undefined,

View File

@ -341,5 +341,11 @@ export function getNuxtConfig(_options) {
consola.level = 0
}
// Use runInNewContext for dev mode by default
const { bundleRenderer } = options.render
if (typeof bundleRenderer.runInNewContext === 'undefined') {
bundleRenderer.runInNewContext = options.dev
}
return options
}

View File

@ -244,7 +244,6 @@ export default class VueRenderer {
const hasModules = fs.existsSync(path.resolve(this.context.options.rootDir, 'node_modules'))
const rendererOptions = {
runInNewContext: false,
clientManifest: this.context.resources.clientManifest,
// for globally installed nuxt command, search dependencies in global dir
basedir: hasModules ? this.context.options.rootDir : __dirname,