fix: replace ~build with nuxt/build

vite sees does not likes ~ for alias when file is in node_modules
This commit is contained in:
Pooya Parsa 2021-02-19 15:21:50 +01:00
parent a1ac066cb5
commit 52592a5d64
4 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,4 @@
declare module '~build/routes' {
declare module 'nuxt/build/routes' {
import { RouteRecordRaw } from 'vue-router'
const _default: RouteRecordRaw[]

View File

@ -6,10 +6,9 @@ import {
RouterLink
} from 'vue-router'
import type { Plugin } from 'nuxt/app'
import routes from 'nuxt/build/routes'
import NuxtPage from './NuxtPage.vue'
import routes from '~build/routes'
export default <Plugin> function router (nuxt) {
const { app } = nuxt

View File

@ -20,7 +20,7 @@ export async function bundle (nuxt: Nuxt) {
resolve: {
alias: {
'nuxt/app': nuxt.options.appDir,
'~build': nuxt.options.buildDir,
'nuxt/build': nuxt.options.buildDir,
'~': nuxt.options.srcDir,
'@': nuxt.options.srcDir
}

View File

@ -109,7 +109,7 @@ function baseAlias (ctx: WebpackConfigContext) {
ctx.alias = {
'nuxt/app': options.appDir,
'~build': options.buildDir,
'nuxt/build': options.buildDir,
...options.alias,
...ctx.alias
}