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' import { RouteRecordRaw } from 'vue-router'
const _default: RouteRecordRaw[] const _default: RouteRecordRaw[]

View File

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

View File

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

View File

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