fix: workaround for vue 3.2.18+ esm bundle issue and revert #566 (#578) (#578)

This commit is contained in:
Daniel Roe 2021-09-29 12:47:36 +01:00 committed by GitHub
parent aaaeb826ba
commit 0c14b0a48b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 13 additions and 157 deletions

View File

@ -35,7 +35,6 @@
"@types/mocha": "^9.0.0",
"@types/node": "^14.17.19",
"@types/object-hash": "^2",
"@vue/server-renderer": "^3.2.19",
"chai": "^4.3.4",
"esbuild": "^0.13.3",
"eslint": "^7.32.0",

View File

@ -17,7 +17,6 @@ export default defineBuildConfig({
'ora',
'vue-bundle-renderer',
'vue-server-renderer',
'@vue/server-renderer',
'vue'
]
})

View File

@ -28,7 +28,6 @@
"@rollup/pluginutils": "^4.1.1",
"@types/jsdom": "^16.2.13",
"@vercel/nft": "^0.15.0",
"@vue/server-renderer": "^3.2.19",
"archiver": "^5.3.0",
"chalk": "^4.1.2",
"chokidar": "^3.5.2",

View File

@ -64,6 +64,13 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
env.polyfill.push('source-map-support/register.js')
}
// TODO: #590
if (nitroContext._nuxt.majorVersion === 3) {
env.alias['vue/server-renderer'] = 'vue/server-renderer'
env.alias['vue/compiler-sfc'] = 'vue/compiler-sfc'
env.alias.vue = require.resolve(`vue/dist/vue.cjs${nitroContext._nuxt.dev ? '' : '.prod'}.js`)
}
const buildServerDir = join(nitroContext._nuxt.buildDir, 'dist/server')
const runtimeAppDir = join(nitroContext._internal.runtimeDir, 'app')

View File

@ -1,5 +1,5 @@
// @ts-ignore
import { renderToString as render } from '@vue/server-renderer'
import { renderToString as render } from 'vue/server-renderer'
export const renderToString: typeof render = (...args) => {
return render(...args).then(result => `<div id="__nuxt">${result}</div>`)

View File

@ -22,7 +22,6 @@
"@nuxt/vite-builder": "^0.10.0",
"@nuxt/webpack-builder": "^0.10.0",
"@vue/reactivity": "3.2.19",
"@vue/server-renderer": "^3.2.19",
"@vue/shared": "3.2.19",
"@vueuse/head": "^0.6.0",
"chokidar": "^3.5.2",

View File

@ -7,7 +7,6 @@ export default defineBuildConfig({
],
dependencies: [
'@nuxt/kit',
'@vue/compiler-sfc',
'vue'
]
})

View File

@ -18,7 +18,6 @@
"dependencies": {
"@nuxt/kit": "^0.10.0",
"@vitejs/plugin-vue": "^1.9.2",
"@vue/compiler-sfc": "^3.2.19",
"chokidar": "^3.5.2",
"consola": "^2.15.3",
"debounce": "^1.2.1",

View File

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

View File

@ -8,7 +8,6 @@ export default defineBuildConfig({
],
dependencies: [
'@nuxt/kit',
'@vue/compiler-sfc',
'@vue/babel-preset-jsx',
'postcss',
'postcss-import-resolver',

View File

@ -16,7 +16,6 @@
"@nuxt/friendly-errors-webpack-plugin": "^2.5.1",
"@nuxt/kit": "^0.10.0",
"@vue/babel-preset-jsx": "^1.2.4",
"@vue/compiler-sfc": "^3.2.19",
"autoprefixer": "^10.3.6",
"babel-loader": "^8.2.2",
"consola": "^2.15.3",

View File

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

136
yarn.lock
View File

@ -1530,7 +1530,6 @@ __metadata:
"@types/node-fetch": ^3.0.2
"@types/serve-static": ^1.13.10
"@vercel/nft": ^0.15.0
"@vue/server-renderer": ^3.2.19
archiver: ^5.3.0
chalk: ^4.1.2
chokidar: ^3.5.2
@ -1599,7 +1598,6 @@ __metadata:
"@nuxt/kit": ^0.10.0
"@types/debounce": ^1.2.1
"@vitejs/plugin-vue": ^1.9.2
"@vue/compiler-sfc": ^3.2.19
chokidar: ^3.5.2
consola: ^2.15.3
debounce: ^1.2.1
@ -1627,7 +1625,6 @@ __metadata:
"@types/webpack-hot-middleware": ^2.25.5
"@types/webpack-virtual-modules": ^0
"@vue/babel-preset-jsx": ^1.2.4
"@vue/compiler-sfc": ^3.2.19
autoprefixer: ^10.3.6
babel-loader: ^8.2.2
consola: ^2.15.3
@ -2768,18 +2765,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/compiler-core@npm:3.2.16":
version: 3.2.16
resolution: "@vue/compiler-core@npm:3.2.16"
dependencies:
"@babel/parser": ^7.15.0
"@vue/shared": 3.2.16
estree-walker: ^2.0.2
source-map: ^0.6.1
checksum: ecf8c88e7c6389b89daa944136e7f85776df6360b3239e05989f5d77309ea26f7cc2f5e0ede236172200c24ff9da762718ca192fb7615367a00e4c221f952987
languageName: node
linkType: hard
"@vue/compiler-core@npm:3.2.19":
version: 3.2.19
resolution: "@vue/compiler-core@npm:3.2.19"
@ -2792,16 +2777,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/compiler-dom@npm:3.2.16":
version: 3.2.16
resolution: "@vue/compiler-dom@npm:3.2.16"
dependencies:
"@vue/compiler-core": 3.2.16
"@vue/shared": 3.2.16
checksum: 0bf167f0e425fe1fa636de81f3ecd56ad53191eac34ed7a160d5cf5401088c663bedc4251bcb83970d079fd829c3d65bd5964e2e5b5db8b5059fc3916d825b57
languageName: node
linkType: hard
"@vue/compiler-dom@npm:3.2.19":
version: 3.2.19
resolution: "@vue/compiler-dom@npm:3.2.19"
@ -2812,25 +2787,7 @@ __metadata:
languageName: node
linkType: hard
"@vue/compiler-sfc@npm:3.2.16":
version: 3.2.16
resolution: "@vue/compiler-sfc@npm:3.2.16"
dependencies:
"@babel/parser": ^7.15.0
"@vue/compiler-core": 3.2.16
"@vue/compiler-dom": 3.2.16
"@vue/compiler-ssr": 3.2.16
"@vue/ref-transform": 3.2.16
"@vue/shared": 3.2.16
estree-walker: ^2.0.2
magic-string: ^0.25.7
postcss: ^8.1.10
source-map: ^0.6.1
checksum: 3653f938371ce6cbf2c81d280b85a30faa9e6b2b7e0481270eec808b1c4208372c86149d786604082c11698440c86a7547306435cd9e494713d4986030868255
languageName: node
linkType: hard
"@vue/compiler-sfc@npm:3.2.19, @vue/compiler-sfc@npm:^3.2.19":
"@vue/compiler-sfc@npm:3.2.19":
version: 3.2.19
resolution: "@vue/compiler-sfc@npm:3.2.19"
dependencies:
@ -2848,16 +2805,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/compiler-ssr@npm:3.2.16":
version: 3.2.16
resolution: "@vue/compiler-ssr@npm:3.2.16"
dependencies:
"@vue/compiler-dom": 3.2.16
"@vue/shared": 3.2.16
checksum: 04a4c8607406ce77512e2c4aee47732e1e6a570098416aa28613b2d81651123c8776bdfb41bbe0a0e6ea29a7f447e0ebbb55e9600b65147744317cd2dd0345e4
languageName: node
linkType: hard
"@vue/compiler-ssr@npm:3.2.19":
version: 3.2.19
resolution: "@vue/compiler-ssr@npm:3.2.19"
@ -2906,15 +2853,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/reactivity@npm:3.2.16":
version: 3.2.16
resolution: "@vue/reactivity@npm:3.2.16"
dependencies:
"@vue/shared": 3.2.16
checksum: 6a752bc31130abda3177076bf1131b8f0492338e70368c58dc768c6e9ce3bcdbb79d21a322052c1b534f632110968044c1a376cc29cf69db31a104cc6596565e
languageName: node
linkType: hard
"@vue/reactivity@npm:3.2.19":
version: 3.2.19
resolution: "@vue/reactivity@npm:3.2.19"
@ -2924,19 +2862,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/ref-transform@npm:3.2.16":
version: 3.2.16
resolution: "@vue/ref-transform@npm:3.2.16"
dependencies:
"@babel/parser": ^7.15.0
"@vue/compiler-core": 3.2.16
"@vue/shared": 3.2.16
estree-walker: ^2.0.2
magic-string: ^0.25.7
checksum: 5be1972627a80938aac7d9cb25066fb001aefdc9bec8041ae4c807d065602ba314619f00333f0695edec20647d3b136762ba3929025551b74a92ad93d0f784af
languageName: node
linkType: hard
"@vue/ref-transform@npm:3.2.19":
version: 3.2.19
resolution: "@vue/ref-transform@npm:3.2.19"
@ -2950,16 +2875,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/runtime-core@npm:3.2.16":
version: 3.2.16
resolution: "@vue/runtime-core@npm:3.2.16"
dependencies:
"@vue/reactivity": 3.2.16
"@vue/shared": 3.2.16
checksum: 650f2dbfe12e64f7004647e3d8b86f117912834400a1ab77e3a87cf26300f5eaf4699e8d1562d87d0591b18bad625199a6c702980147bb7969d6b802207c86f3
languageName: node
linkType: hard
"@vue/runtime-core@npm:3.2.19":
version: 3.2.19
resolution: "@vue/runtime-core@npm:3.2.19"
@ -2970,17 +2885,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/runtime-dom@npm:3.2.16":
version: 3.2.16
resolution: "@vue/runtime-dom@npm:3.2.16"
dependencies:
"@vue/runtime-core": 3.2.16
"@vue/shared": 3.2.16
csstype: ^2.6.8
checksum: 79af18d954dd2433d023fe8a8a2d353cfd2e387277280e7da5e7548bb31f96127b2f9574ddd58e5da4fa19868d46f2ff40cc87e814f01aad8cb5e12868b23453
languageName: node
linkType: hard
"@vue/runtime-dom@npm:3.2.19":
version: 3.2.19
resolution: "@vue/runtime-dom@npm:3.2.19"
@ -2992,19 +2896,7 @@ __metadata:
languageName: node
linkType: hard
"@vue/server-renderer@npm:3.2.16":
version: 3.2.16
resolution: "@vue/server-renderer@npm:3.2.16"
dependencies:
"@vue/compiler-ssr": 3.2.16
"@vue/shared": 3.2.16
peerDependencies:
vue: 3.2.16
checksum: 007c947b377fe897d04bf39ea62f3136f02056e0a17fb2b8039605765688e2647c43c05901a09f99d46e81a1d4a6365fdd31f1d9391b7ba539f30612413ca57c
languageName: node
linkType: hard
"@vue/server-renderer@npm:3.2.19, @vue/server-renderer@npm:^3.2.19":
"@vue/server-renderer@npm:3.2.19":
version: 3.2.19
resolution: "@vue/server-renderer@npm:3.2.19"
dependencies:
@ -3016,13 +2908,6 @@ __metadata:
languageName: node
linkType: hard
"@vue/shared@npm:3.2.16":
version: 3.2.16
resolution: "@vue/shared@npm:3.2.16"
checksum: 0f23f56859b5e0dc76b80c27da801b21677efd8e26cfbf8fc28bffa248ebaefde3c2296a9a9bbb2b80e6d3188c8907a7ea1d2ec6f41d650bace04b96838009fe
languageName: node
linkType: hard
"@vue/shared@npm:3.2.19":
version: 3.2.19
resolution: "@vue/shared@npm:3.2.19"
@ -10151,7 +10036,6 @@ fsevents@~2.3.2:
"@types/mocha": ^9.0.0
"@types/node": ^14.17.19
"@types/object-hash": ^2
"@vue/server-renderer": ^3.2.19
chai: ^4.3.4
esbuild: ^0.13.3
eslint: ^7.32.0
@ -10219,7 +10103,6 @@ fsevents@~2.3.2:
"@types/fs-extra": ^9.0.13
"@types/hash-sum": ^1.0.0
"@vue/reactivity": 3.2.19
"@vue/server-renderer": ^3.2.19
"@vue/shared": 3.2.19
"@vueuse/head": ^0.6.0
chokidar: ^3.5.2
@ -14262,20 +14145,7 @@ fsevents@~2.3.2:
languageName: node
linkType: hard
"vue@npm:3.2.16, vue@npm:^3":
version: 3.2.16
resolution: "vue@npm:3.2.16"
dependencies:
"@vue/compiler-dom": 3.2.16
"@vue/compiler-sfc": 3.2.16
"@vue/runtime-dom": 3.2.16
"@vue/server-renderer": 3.2.16
"@vue/shared": 3.2.16
checksum: 3fdc96fa48f39b169472e03af43eda1b97107b1450eabf1599bc83de48ad9aae63b73ae64193734c970b505aed4c37292aaac2f592a19d9464dc6055fc1856bc
languageName: node
linkType: hard
"vue@npm:3.2.19, vue@npm:^3.2.19":
"vue@npm:3.2.19, vue@npm:^3, vue@npm:^3.2.19":
version: 3.2.19
resolution: "vue@npm:3.2.19"
dependencies: