Skip to content

Commit

Permalink
feat: better error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Dec 12, 2020
1 parent c0fc176 commit d8cf235
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/module/nuxt2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import wpfs from '../utils/wpfs'
export default function (nuxt, moduleContainer) {
// Build in node_modules/.cache/nuxt
const oldBuildDir = nuxt.options.buildDir
nuxt.options.buildDir = resolve(nuxt.options.rootDir, 'node_modules/.cache/nuxt')
if (!nuxt.options.dev) {
nuxt.options.buildDir = resolve(nuxt.options.rootDir, 'node_modules/.cache/nuxt')
}
nuxt.options.build.transpile = nuxt.options.build.transpile || []
nuxt.options.build.transpile.push(nuxt.options.buildDir)
nuxt.options.appTemplatePath = nuxt.options.appTemplatePath
Expand Down
5 changes: 4 additions & 1 deletion src/rollup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {
'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.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)
}
}))

Expand Down Expand Up @@ -159,10 +160,12 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {

// https://github.com/rollup/plugins/tree/master/packages/alias
const renderer = sigmaContext.renderer || 'vue2'
const vueServerRenderer = 'vue-server-renderer/' + (sigmaContext._nuxt.dev ? 'build.dev.js' : 'build.prod.js')
rollupConfig.plugins.push(alias({
entries: {
'~runtime': sigmaContext._internal.runtimeDir,
'~renderer': require.resolve(resolve(sigmaContext._internal.runtimeDir, 'app', renderer)),
'~vueServerRenderer': vueServerRenderer,
'~build': sigmaContext._nuxt.buildDir,
...env.alias
}
Expand Down

0 comments on commit d8cf235

Please sign in to comment.