You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
plugin-vue merges inline TS scripts in SFC, and compiles them itself with ESBuild.
Doing so bypasses any loader configuration for TS, which is unexpected and creates problems (see below).
The easiest fix is to go back to not inlining TS outside devServer.
A more complex fix is to apply loaders from config when building TS inside SFC. This is IMHO less preferred because it has a high impact on the performance of devServer.
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/core instead.
Partial revert of 93d9a2d
When building, TS scripts must not be inlined so that loaders (e.g. rollup-plugin-typescript2) are correctly applied.
Fixesvitejs#5044, vitejs#5795, vitejs#7908
Describe the bug
plugin-vue
merges inline TS scripts in SFC, and compiles them itself with ESBuild.Doing so bypasses any loader configuration for TS, which is unexpected and creates problems (see below).
This is a regression that was introduced in 1.8 by this commit 93d9a2d#diff-50999b66ad3fff48fd315417d4f8c98741da9f85a0fa6bb4ba212cc8f8bac967L271-R267
Specifically, the new behavior is to always merge inline ts scripts (previously it was done only for devServer):
vite/packages/plugin-vue/src/main.ts
Lines 267 to 268 in 93d9a2d
Once merged, the inlined ts scripts are converted to JS by esbuild directly, without regard for any specific loader / config:
vite/packages/plugin-vue/src/main.ts
Lines 190 to 205 in 93d9a2d
This breaks builds that have non-default configuration. Solving this will close the following issues:
The easiest fix is to go back to not inlining TS outside devServer.
A more complex fix is to apply loaders from config when building TS inside SFC. This is IMHO less preferred because it has a high impact on the performance of devServer.
Reproduction
See #5044 or #5795
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: