-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
Description
Describe the bug
Invalid Babel configuration
// App.vue
const num = window?.num ?? 9;
console.log(num);// babel.config.js
module.exports = {
presets: [
"@vue/cli-plugin-babel/preset",
"@babel/plugin-proposal-optional-chaining"
]
};// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import legacy from '@vitejs/plugin-legacy'
import babel from 'vite-babel-plugin'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
(babel as any)(),
// legacy({
// additionalLegacyPolyfills: ['@babel/plugin-proposal-optional-chaining'],
// targets: ['chrome 70']
// })
],
build: {
target: ['es2015'],
// target: ['chrome70']
},
})Reproduction
https://github.com/yangdan8/vite2-vue3-ts-demo
System Info
QQ browser 10
Chrome70Used Package Manager
yarn
Logs
Uncaught SyntaxError: Unexpected token .Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable