Closed IndexXuan closed 3 years ago
@underfin @huih99 @zhangyuang
vue-template-compiler
的源码显示,只要被 require 或者 import 就会立即 check 然后直接 throw error 结束,所以你给用户的从外部传入 vue-template-compiler
来解决问题,是根本没有时机执行的,也是无效的 ?
@underfin cc
search all my node_modules with keyword vue-template-compiler
.(by code some-vue-projet/node_modules)
It is and should be a user-land deps, since lots of tools use it, something like vite-plugin-vue2
, fork-ts-checker-webpack-plugin
& vue-loader
& vue-jest
and so on. we cannot order every tools include a vue-template-compiler
It should peerDeps @huih99 you are right.
I know that since
vue-template-compiler
move back to deps. there will bevue version mistach issue
, so you provide thevueTemplateCompiler
options for user to custom the compiler, something like pass-in require('vue-template-compiler')BUT the
vite-plugin-vue2
itself import thevue-template-compiler
and the error throws immediately that this options is useless.https://github.com/vuejs/vue/blob/dev/packages/vue-template-compiler/index.js#L10
https://github.com/underfin/vite-plugin-vue2/blob/6fa3cd0beae76e5415fb7509681e76b98b4c4417/src/utils/descriptorCache.ts#L5 https://github.com/underfin/vite-plugin-vue2/blob/0deeabaa2b3033ab78d50cb41fa1f04ea48686d8/src/template.ts#L2
Also the @vitejs/plugin-vue put compiler(@vue/compiler-sfc) to peerDeps. should we align with Vue 3? https://github.com/vitejs/vite/blob/main/packages/plugin-vue/package.json#L32