From 06177a4d240e9a35c4a29374d4f28dbf52cc40b9 Mon Sep 17 00:00:00 2001 From: Jeff Sagal Date: Tue, 19 Oct 2021 18:53:22 -0700 Subject: [PATCH] feat: Vue 3 Support (#1344) BREAKING CHANGE: drop vue 2 support --- .github/workflows/release.yml | 2 + build/webpack.base.conf.js | 4 +- build/webpack.prod.conf.js | 3 + dev/dev.js | 10 +- docs/.vuepress/components/Paginated.vue | 6 +- docs/.vuepress/components/Sandbox.vue | 8 +- package.json | 14 +- release.config.js | 4 +- src/components/Select.vue | 51 +- src/directives/appendToBody.js | 14 +- tests/helpers.js | 19 +- tests/unit/Ajax.spec.js | 4 +- tests/unit/Autoscroll.spec.js | 20 +- tests/unit/Components.spec.js | 10 +- tests/unit/CreateOption.spec.js | 2 +- tests/unit/Deselecting.spec.js | 39 +- tests/unit/Dropdown.spec.js | 30 +- tests/unit/Filtering.spec.js | 16 +- tests/unit/Keydown.spec.js | 51 +- tests/unit/Labels.spec.js | 6 +- tests/unit/Layout.spec.js | 2 +- tests/unit/ReactiveOptions.spec.js | 69 ++- tests/unit/Reduce.spec.js | 90 +-- tests/unit/Selectable.spec.js | 18 +- tests/unit/Selecting.spec.js | 65 ++- tests/unit/Slots.spec.js | 54 +- tests/unit/Tagging.spec.js | 21 +- tests/unit/TypeAhead.spec.js | 6 +- yarn.lock | 697 +++++++++++++++--------- 29 files changed, 774 insertions(+), 561 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7a1ebc..8ac4b6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,8 @@ on: push: branches: - master + - next + - beta jobs: release: runs-on: ubuntu-18.04 diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index 31c5ecc..84d00f9 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -25,7 +25,7 @@ module.exports = { assets: path.resolve(__dirname, '../docs/assets'), mixins: path.resolve(__dirname, '../src/mixins'), components: path.resolve(__dirname, '../src/components'), - vue$: 'vue/dist/vue.esm.js', + vue$: 'vue/dist/vue.runtime.esm-bundler.js', }, }, module: { @@ -54,6 +54,8 @@ module.exports = { plugins: [ new webpack.DefinePlugin({ 'process.env': env, + __VUE_OPTIONS_API__: true, + __VUE_PROD_DEVTOOLS__: false, }), new MiniCssExtractPlugin({ filename: 'vue-select.css', diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 12f017a..b668a0b 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -10,6 +10,9 @@ module.exports = merge(baseWebpackConfig, { libraryTarget: 'umd', globalObject: "typeof self !== 'undefined' ? self : this", }, + externals: { + vue: 'vue', + }, optimization: { minimizer: [ new TerserPlugin({ diff --git a/dev/dev.js b/dev/dev.js index a30ef78..831fc97 100644 --- a/dev/dev.js +++ b/dev/dev.js @@ -1,8 +1,6 @@ -import Vue from 'vue' +import { createApp, h } from 'vue' import Dev from './Dev.vue' -Vue.config.productionTip = false - -new Vue({ - render: (h) => h(Dev), -}).$mount('#app') +createApp({ + render: () => h(Dev), +}).mount('#app') diff --git a/docs/.vuepress/components/Paginated.vue b/docs/.vuepress/components/Paginated.vue index 30b04cc..a566ef6 100644 --- a/docs/.vuepress/components/Paginated.vue +++ b/docs/.vuepress/components/Paginated.vue @@ -1,5 +1,9 @@