Skip to content

Commit

Permalink
feat: dedupe the vue in client bundle by default
Browse files Browse the repository at this point in the history
Fixes vitejs#2443
Fixes vitejs#7454

It's already been set by default in Nuxt 3 for a while now nuxt/framework#6735
So I think this change should be harmless.
And technically it could be considered a fix than a feat.

Nevertheless, it's better to ship it in v4 to minimize disruptions on
the user side.

Things that are not covered in this PR:
1. SSR, because `resolve.dedupe` doesn't work for ESM build outputs, and
the CommonJS version is kinda hacky, I think it's better to skip the
config for SSR completely. Besides, most related issues are from the
client side.
2. #5958 isn't fixed by this PR.
  • Loading branch information
haoqunjiang committed Nov 22, 2022
1 parent 1b1f633 commit e073f5a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {

config(config) {
return {
resolve: {
dedupe: config.build?.ssr ? [] : ['vue']
},
define: {
__VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true,
__VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false
Expand Down

0 comments on commit e073f5a

Please sign in to comment.