Skip to content

Commit

Permalink
Vue 3: Disable compat mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Jan 21, 2023
1 parent 345cc0d commit 2d21bc2
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 79 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/change-update-vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ https://github.com/owncloud/web/pull/8256
https://github.com/owncloud/web/pull/8257
https://github.com/owncloud/web/pull/8258
https://github.com/owncloud/web/pull/8282
https://github.com/owncloud/web/pull/8288
8 changes: 1 addition & 7 deletions packages/tsconfig/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@
"node_modules"
],
"vueCompilerOptions": {
"experimentalCompatMode": 2,
"experimentalTemplateCompilerOptions": {
"compatConfig": {
"MODE": 2
} // optional
},
"target": 2.7
"target": 3
}
}
48 changes: 0 additions & 48 deletions packages/web-runtime/src/compatConfig.ts

This file was deleted.

5 changes: 1 addition & 4 deletions packages/web-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@ import {
} from 'web-client/src/helpers'
import { WebDAV } from 'web-client/src/webdav'
import { DavProperty } from 'web-client/src/webdav/constants'
import { configureCompat, createApp } from 'vue'
import { compatConfig } from './compatConfig'
import { createApp } from 'vue'
import PortalVue, { createWormhole } from 'portal-vue'

import WebPlugin from './plugins/web'
import Avatar from './components/Avatar.vue'
import focusMixin from './mixins/focusMixin'
import lifecycleMixin from './mixins/lifecycleMixin'

configureCompat(compatConfig)

export const bootstrapApp = async (configurationPath: string): Promise<void> => {
const app = createApp(pages.success)

Expand Down
1 change: 0 additions & 1 deletion tests/unit/config/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
'\\.(css|less|scss)$': '<rootDir>/tests/unit/stubs/empty.js',
'^@/(.*)$': '<rootDir>/$1',
'^core-js$': '<rootDir>/node_modules/core-js',
'^vue$': '@vue/compat',
'^mark.js$': '<rootDir>/node_modules/mark.js/src/vanilla.js',
'^fuse.js$': '<rootDir>/node_modules/fuse.js/dist/fuse.esm.js',
'^filesize$': '<rootDir>/node_modules/filesize/lib/filesize.esm.js',
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/config/jest.init.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { configureCompat } from 'vue'
import fetchMock from 'jest-fetch-mock'

import { compatConfig } from '../../../packages/web-runtime/src/compatConfig'

configureCompat(compatConfig)

window.define = jest.fn()

window.IntersectionObserver = jest.fn(() => ({
Expand Down
8 changes: 1 addition & 7 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ import browserslistToEsbuild from 'browserslist-to-esbuild'
import { CompilerOptions } from '@vue/compiler-sfc'

export const compilerOptions: CompilerOptions = {
whitespace: 'preserve',
compatConfig: {
MODE: 2,
COMPILER_V_ON_NATIVE: false
}
whitespace: 'preserve'
}

const buildConfig = {
Expand Down Expand Up @@ -134,8 +130,6 @@ export default defineConfig(({ mode, command }) => {
},
resolve: {
alias: {
vue: '@vue/compat',

crypto: join(projectRootDir, 'polyfills/crypto.js'),
buffer: 'rollup-plugin-node-polyfills/polyfills/buffer-es6',
path: 'rollup-plugin-node-polyfills/polyfills/path',
Expand Down
11 changes: 4 additions & 7 deletions web.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/// <reference types="vite/client" />

declare module 'vue' {
import { CompatVue } from '@vue/runtime-dom'
const Vue: CompatVue
export default Vue
export * from '@vue/runtime-dom'
const { configureCompat } = Vue
export { configureCompat }

export interface GlobalComponents {
Portal: typeof import('portal-vue')['Portal']
Expand All @@ -16,7 +11,9 @@ declare module 'vue' {
RouterView: typeof import('vue-router')['RouterView']
}
}

declare module '*.vue' {
import Vue from 'vue'
export default Vue
import { defineComponent } from 'vue'
const component: ReturnType<typeof defineComponent>
export default component
}

0 comments on commit 2d21bc2

Please sign in to comment.