-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
compiler-sfc not compatible with prettier v3 #13052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Added a workaround in vue-loader v15.10.2. https://github.com/vuejs/vue-loader/releases/tag/v15.10.2 But let's keep this issue open so that we can fix it properly in vue core later. |
Hi @sodatea! The problem is caused by not specifying the required prettier version in the While Prettier 3 is not supported, a simple solution could be to specify the Prettier version in optional dependencies. It would keep prettifying working even if Prettier 3 is installed. There is a PR that does this: #13053 The same solution was applied by you before, but it was lost during migration to Vue 2.7: vuejs/component-compiler-utils@aea1b79 |
I faced this issue via vue-jest. It throws errors like this.
Current workaround is to set the module.exports = {
globals: {
'vue-jest': {
templateCompiler: {
prettify: false,
},
},
},
// ...
} |
Tysm for this fix @yshrsmz |
Version
2.7.14
Reproduction link
I think it's not necessary as it's obvious in source code
Steps to reproduce
Install prettier v3 in a project depending on vue/compiler-sfc v2
What is expected?
No error
What is actually happening?
Fail in compiling template.
I found compiler-sfc tried to format code with API of prettier but
format
of Prettier becomes async in v3 and it returns a Promise instead of string.vue/packages/compiler-sfc/src/compileTemplate.ts
Line 179 in 49b6bd4
The text was updated successfully, but these errors were encountered: