feat: better error handler

This commit is contained in:
Pooya Parsa 2020-12-12 19:15:56 +01:00
parent 2c83f6ea6a
commit 7e682ed663
2 changed files with 7 additions and 2 deletions

View File

@ -8,7 +8,9 @@ import wpfs from '../utils/wpfs'
export default function (nuxt, moduleContainer) { export default function (nuxt, moduleContainer) {
// Build in node_modules/.cache/nuxt // Build in node_modules/.cache/nuxt
const oldBuildDir = nuxt.options.buildDir const oldBuildDir = nuxt.options.buildDir
if (!nuxt.options.dev) {
nuxt.options.buildDir = resolve(nuxt.options.rootDir, 'node_modules/.cache/nuxt') nuxt.options.buildDir = resolve(nuxt.options.rootDir, 'node_modules/.cache/nuxt')
}
nuxt.options.build.transpile = nuxt.options.build.transpile || [] nuxt.options.build.transpile = nuxt.options.build.transpile || []
nuxt.options.build.transpile.push(nuxt.options.buildDir) nuxt.options.build.transpile.push(nuxt.options.buildDir)
nuxt.options.appTemplatePath = nuxt.options.appTemplatePath nuxt.options.appTemplatePath = nuxt.options.appTemplatePath

View File

@ -119,7 +119,8 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {
'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) 'process.env.RUNTIME_CONFIG': JSON.stringify(sigmaContext._nuxt.runtimeConfig),
'process.env.DEBUG': JSON.stringify(sigmaContext._nuxt.dev)
} }
})) }))
@ -159,10 +160,12 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {
// https://github.com/rollup/plugins/tree/master/packages/alias // https://github.com/rollup/plugins/tree/master/packages/alias
const renderer = sigmaContext.renderer || 'vue2' const renderer = sigmaContext.renderer || 'vue2'
const vueServerRenderer = 'vue-server-renderer/' + (sigmaContext._nuxt.dev ? 'build.dev.js' : 'build.prod.js')
rollupConfig.plugins.push(alias({ rollupConfig.plugins.push(alias({
entries: { entries: {
'~runtime': sigmaContext._internal.runtimeDir, '~runtime': sigmaContext._internal.runtimeDir,
'~renderer': require.resolve(resolve(sigmaContext._internal.runtimeDir, 'app', renderer)), '~renderer': require.resolve(resolve(sigmaContext._internal.runtimeDir, 'app', renderer)),
'~vueServerRenderer': vueServerRenderer,
'~build': sigmaContext._nuxt.buildDir, '~build': sigmaContext._nuxt.buildDir,
...env.alias ...env.alias
} }