fix: ensure builds are relative to buildDir

This commit is contained in:
Pooya Parsa 2020-11-02 01:13:35 +01:00
parent ef4e5443aa
commit a9a262f258

View File

@ -33,6 +33,9 @@ async function main () {
consola.success('Using existing nuxt build from', prettyPath(config.buildDir)) consola.success('Using existing nuxt build from', prettyPath(config.buildDir))
} }
// Ensure relative operations are relative to build dir (fixes rollup dynamic imports)
process.chdir(config.buildDir)
// Compile html template // Compile html template
const htmlTemplateFile = resolve(config.buildDir, 'views/app.template.html') // TODO: nuxt3: document.template.html const htmlTemplateFile = resolve(config.buildDir, 'views/app.template.html') // TODO: nuxt3: document.template.html
const htmlTemplateFileJS = htmlTemplateFile.replace(/.html$/, '.js').replace('app.', 'document.') const htmlTemplateFileJS = htmlTemplateFile.replace(/.html$/, '.js').replace('app.', 'document.')
@ -78,7 +81,6 @@ async function main () {
consola.success('Generated', prettyPath((ctx.rollupConfig.output as any).file), consola.success('Generated', prettyPath((ctx.rollupConfig.output as any).file),
chalk.gray(`(Size: ${size} Gzip: ${zSize})`) chalk.gray(`(Size: ${size} Gzip: ${zSize})`)
) )
await hooks.callHook('rollup:done', ctx) await hooks.callHook('rollup:done', ctx)
} }
} }