vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
68.12k stars 6.14k forks source link

Vite>=3.1.0 does not work with Vue 2.7 & TS target ES2015 #10453

Closed Tanimodori closed 2 years ago

Tanimodori commented 2 years ago

Describe the bug

Vite >=3.1.0 does not work with Vue 2.7 and TS target ES2015, showing

image

Either downgrade Vite to 3.0.9 or set TS target to ESNext resolves the problem.

Reproduction

https://github.com/Tanimodori/ngvue-vite

Steps to reproduce

Despite the project was called ngvue-vite, this branch has no angular nor ngVue. It is pure vue2.

The working-vue branch is working as expected, while the broken-vue branch is broken.

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 7.26 GB / 15.69 GB
  Binaries:
    Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.521.0), Chromium (106.0.1370.42)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @vitejs/plugin-vue2: ^2.0.0 => 2.0.0 
    vite: ^3.1.0 => 3.1.0

Used Package Manager

npm

Logs

Click to expand! ```shell PS C:\path\to\project\ngvue-vite> npx vite --debug vite:config bundled config file loaded in 82.58ms +0ms vite:esbuild init tsconfck (root: C:/path/to/project/ngvue-vite) +0ms vite:esbuild init tsconfck (root: C:/path/to/project/ngvue-vite) +2ms vite:esbuild init tsconfck end +2ms vite:esbuild init tsconfck end +0ms vite:config using resolved config: { vite:config root: 'C:/path/to/project/ngvue-vite', vite:config build: { vite:config target: 'es2015', vite:config polyfillModulePreload: true, vite:config outDir: 'dist', vite:config assetsDir: 'assets', vite:config assetsInlineLimit: 4096, vite:config cssCodeSplit: true, vite:config cssTarget: 'es2015', vite:config sourcemap: false, vite:config rollupOptions: {}, vite:config minify: 'esbuild', vite:config terserOptions: {}, vite:config write: true, vite:config emptyOutDir: true, vite:config manifest: false, vite:config lib: false, vite:config ssr: false, vite:config ssrManifest: false, vite:config reportCompressedSize: true, vite:config chunkSizeWarningLimit: 500, vite:config watch: null, vite:config commonjsOptions: { include: [Array], extensions: [Array] }, vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] } vite:config }, vite:config plugins: [ vite:config 'vite:pre-alias', vite:config 'alias', vite:config 'vite:modulepreload-polyfill', vite:config 'vite:optimized-deps', vite:config 'vite:resolve', vite:config 'vite:html-inline-proxy', vite:config 'vite:css', vite:config 'vite:esbuild', vite:config 'vite:json', vite:config 'vite:wasm-helper', vite:config 'vite:worker', vite:config 'vite:asset', vite:config 'vite:vue2', vite:config 'vite:wasm-fallback', vite:config 'vite:define', vite:config 'vite:css-post', vite:config 'vite:worker-import-meta-url', vite:config 'vite:dynamic-import-vars', vite:config 'vite:import-glob', vite:config 'vite:client-inject', vite:config 'vite:import-analysis' vite:config ], vite:config optimizeDeps: { vite:config disabled: 'build', vite:config force: undefined, vite:config esbuildOptions: { preserveSymlinks: undefined } vite:config }, vite:config server: { vite:config preTransformRequests: true, vite:config middlewareMode: false, vite:config fs: { strict: true, allow: [Array], deny: [Array] } vite:config }, vite:config configFile: 'C:/path/to/project/ngvue-vite/vite.config.ts', vite:config configFileDependencies: [ 'C:/path/to/project/ngvue-vite/vite.config.ts' ], vite:config inlineConfig: { vite:config root: undefined, vite:config base: undefined, vite:config mode: undefined, vite:config configFile: undefined, vite:config logLevel: undefined, vite:config clearScreen: undefined, vite:config optimizeDeps: { force: undefined }, vite:config server: {} vite:config }, vite:config base: '/', vite:config resolve: { alias: [ [Object], [Object], [Object] ] }, vite:config publicDir: 'C:\\path\\to\\project\\ngvue-vite\\public', vite:config cacheDir: 'C:\\path\\to\\project\\ngvue-vite\\node_modules\\.vite', vite:config command: 'serve', vite:config mode: 'development', vite:config ssr: { vite:config format: 'esm', vite:config target: 'node', vite:config optimizeDeps: { disabled: true, esbuildOptions: [Object] } vite:config }, vite:config isWorker: false, vite:config mainConfig: null, vite:config isProduction: false, vite:config preview: { vite:config port: undefined, vite:config strictPort: undefined, vite:config host: undefined, vite:config https: undefined, vite:config open: undefined, vite:config proxy: undefined, vite:config cors: undefined, vite:config headers: undefined vite:config }, vite:config env: { BASE_URL: '/', MODE: 'development', DEV: true, PROD: false }, vite:config assetsInclude: [Function: assetsInclude], vite:config logger: { vite:config hasWarned: false, vite:config info: [Function: info], vite:config warn: [Function: warn], vite:config warnOnce: [Function: warnOnce], vite:config error: [Function: error], vite:config clearScreen: [Function: clearScreen], vite:config hasErrorLogged: [Function: hasErrorLogged] vite:config }, vite:config packageCache: Map(0) {}, vite:config createResolver: [Function: createResolver], vite:config worker: { vite:config format: 'iife', vite:config plugins: [ vite:config 'vite:pre-alias', vite:config 'alias', vite:config 'vite:modulepreload-polyfill', vite:config 'vite:optimized-deps', vite:config 'vite:resolve', vite:config 'vite:html-inline-proxy', vite:config 'vite:css', vite:config 'vite:esbuild', vite:config 'vite:json', vite:config 'vite:wasm-helper', vite:config 'vite:worker', vite:config 'vite:asset', vite:config 'vite:wasm-fallback', vite:config 'vite:define', vite:config 'vite:css-post', vite:config 'vite:worker-import-meta-url', vite:config 'vite:dynamic-import-vars', vite:config 'vite:import-glob', vite:config 'vite:client-inject', vite:config 'vite:import-analysis' vite:config ], vite:config rollupOptions: {}, vite:config getSortedPlugins: [Function: getSortedPlugins], vite:config getSortedPluginHooks: [Function: getSortedPluginHooks] vite:config }, vite:config appType: 'spa', vite:config experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false }, vite:config getSortedPlugins: [Function: getSortedPlugins], vite:config getSortedPluginHooks: [Function: getSortedPluginHooks] vite:config } +10ms vite:deps Hash is consistent. Skipping. Use --force to override. +0ms VITE v3.1.0 ready in 360 ms ➜ Local: http://127.0.0.1:5173/ ➜ Network: use --host to expose vite:spa-fallback Rewriting GET / to /index.html +0ms vite:time 21.40ms /index.html +0ms vite:spa-fallback Rewriting GET / to /index.html +29ms vite:time 6.80ms /index.html +17ms vite:resolve 1.84ms /src/index.ts -> C:/path/to/project/ngvue-vite/src/index.ts +0ms vite:resolve 0.95ms C:\path\to\project\ngvue-vite\node_modules\vite\dist\client\client.mjs -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/client.mjs +6ms vite:resolve 1.49ms /@vite/client -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/client.mjs +1ms vite:load 8.19ms [fs] /src/index.ts +0ms vite:load 4.79ms [fs] /@vite/client +4ms vite:resolve 1.82ms C:\path\to\project\ngvue-vite\node_modules\vite\dist\client\env.mjs -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/env.mjs +22ms vite:resolve 2.38ms @vite/env -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/env.mjs +1ms vite:resolve 1.16ms /node_modules/vite/dist/client/env.mjs -> C:/path/to/project/ngvue-vite/node_modules/vite/dist/client/env.mjs +1ms vite:import-analysis 9.91ms [1 imports rewritten] node_modules\vite\dist\client\client.mjs +0ms vite:transform 18.46ms /@vite/client +0ms vite:time 30.10ms /@vite/client +130ms vite:resolve 0.38ms vue -> C:/path/to/project/ngvue-vite/node_modules/.vite/deps/vue.js?v=151fde2c +11ms vite:resolve 0.24ms /node_modules/.vite/deps/vue.js?v=151fde2c -> C:/path/to/project/ngvue-vite/node_modules/.vite/deps/vue.js?v=151fde2c +0ms vite:resolve 1.12ms ./views/AppView.vue -> C:/path/to/project/ngvue-vite/src/views/AppView.vue +2ms vite:resolve 0.89ms /src/views/AppView.vue -> C:/path/to/project/ngvue-vite/src/views/AppView.vue +1ms vite:import-analysis 5.88ms [2 imports rewritten] src\index.ts +14ms vite:transform 35.30ms /src/index.ts +13ms vite:time 52.04ms /src/index.ts +14ms vite:optimize-deps load C:/path/to/project/ngvue-vite/node_modules/.vite/deps/vue.js +0ms vite:load 22.74ms [fs] /node_modules/vite/dist/client/env.mjs +47ms vite:load 19.88ms [plugin] /node_modules/.vite/deps/vue.js?v=151fde2c +10ms vite:import-analysis 2.95ms [no imports] node_modules\.vite\deps\vue.js?v=151fde2c +35ms vite:transform 5.19ms /node_modules/.vite/deps/vue.js?v=151fde2c +35ms vite:load 31.09ms [fs] /src/views/AppView.vue +12ms vite:import-analysis 2.39ms [no imports] node_modules\vite\dist\client\env.mjs +76ms vite:transform 89.28ms /node_modules/vite/dist/client/env.mjs +76ms vite:cache [memory] /node_modules/.vite/deps/vue.js?v=151fde2c +0ms vite:time 0.85ms /node_modules/.vite/deps/vue.js?v=151fde2c +118ms vite:cache [304] /node_modules/vite/dist/client/env.mjs +0ms vite:time 1.65ms /node_modules/vite/dist/client/env.mjs +6ms vite:resolve 0.80ms /@id/__x00__plugin-vue2:normalizer -> null +182ms vite:resolve 0.66ms /@id/__x00__plugin-vue2:hmr-runtime -> null +1ms vite:import-analysis 4.10ms [3 imports rewritten] src\views\AppView.vue +71ms vite:transform 145.96ms /src/views/AppView.vue +72ms vite:cache [memory] /node_modules/.vite/deps/vue.js?v=151fde2c +63ms vite:load 0.04ms [plugin] plugin-vue2:normalizer +147ms vite:load 0.08ms [plugin] plugin-vue2:hmr-runtime +0ms vite:import-analysis 0.04ms [no imports] plugin-vue2:normalizer +1ms vite:import-analysis 0.13ms [no imports] plugin-vue2:hmr-runtime +0ms vite:transform 0.25ms plugin-vue2:normalizer +1ms vite:transform 0.32ms plugin-vue2:hmr-runtime +0ms vite:time 64.72ms /src/views/AppView.vue +60ms vite:cache [304] plugin-vue2:normalizer +67ms vite:time 0.81ms /@id/__x00__plugin-vue2:normalizer +7ms vite:cache [304] plugin-vue2:hmr-runtime +2ms vite:time 0.84ms /@id/__x00__plugin-vue2:hmr-runtime +1ms vite:time 10.99ms /node_modules/.vite/deps/vue.js.map +22ms vite:deps ✨ static imports crawl ended +635ms ```

Validations

Tanimodori commented 2 years ago

Duplicate #10259 #10167 This problem still exist in 3.2.0-beta.1