fix: workaround for vue/server-renderer import, close #563 (#566)

This commit is contained in:
Anthony Fu 2021-09-24 17:49:04 +08:00 committed by GitHub
parent f718a33548
commit c8f8691496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -50,7 +50,14 @@ export async function buildServer (ctx: ViteBuildContext) {
}, },
plugins: [ plugins: [
cacheDirPlugin(ctx.nuxt.options.rootDir, 'server'), cacheDirPlugin(ctx.nuxt.options.rootDir, 'server'),
vuePlugin(), vuePlugin({
// workaround for https://github.com/vuejs/vue-next/issues/4666
template: {
compilerOptions: {
ssrRuntimeModuleName: 'vue/server-renderer/index.mjs'
}
}
}),
transformNuxtSetup() transformNuxtSetup()
] ]
} as ViteOptions) } as ViteOptions)

View File

@ -14,7 +14,13 @@ export function vue (ctx: WebpackConfigContext) {
config.module.rules.push({ config.module.rules.push({
test: /\.vue$/i, test: /\.vue$/i,
loader: 'vue-loader', loader: 'vue-loader',
options: options.build.loaders.vue options: {
// workaround for https://github.com/vuejs/vue-next/issues/4666
compilerOptions: {
ssrRuntimeModuleName: 'vue/server-renderer/index.mjs'
},
...options.build.loaders.vue
}
}) })
if (ctx.isClient) { if (ctx.isClient) {