Closed vanchKong closed 1 year ago
@vanchKong 你的@vue/compiler-sfc是什么版本? 如果能提供一个最小的复现demo就更好了.
@vanchKong 你的@vue/compiler-sfc是什么版本? 如果能提供一个最小的复现demo就更好了.
我找到原因了,在 prettier
2.8.8版本中 .format()
方法返回了一个 string
,在3.0.1中,返回的是 string的promise对象。
.format()
方法在 /@vue/compiler-sfc/dist/compiler-sfc.js
中调用了。
compileVueTemplate(unplugin-svg-component)
>>> compileTemplate(compiler-sfc)
>>> actuallyCompile(compiler-sfc)
>>> format(prettier)
上面的代码将 prettier
回退到 @2 就没问题了
https://github.com/Jevon617/unplugin-svg-component/blob/b70a717d4ba9041ea44e8d424aa562be9178fea3/src/core/generator.ts#L133
这里的
code
变成promise对象了