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
Should filter vite virtual files when transform #50
Comments
emmm....破电脑没法 push 代码,放个 patch 吧🤣 --- plugin.ts 2022-01-05 15:47:52.824843900 +0800
+++ plugin-mod.ts 2022-01-05 15:13:31.864190100 +0800
@@ -188,7 +188,7 @@
project.createSourceFile(`${id}.${ext || 'js'}`, content, { overwrite: true })
}
- } else if (!id.includes('.vue?vue') && (tsRE.test(id) || (allowJs && jsRE.test(id)))) {
+ } else if (!id.includes('.vue?vue') && (tsRE.test(id) || (allowJs && jsRE.test(id))) && !id.startsWith('\0')) {
project.addSourceFileAtPath(id)
}
@@ -242,7 +242,7 @@
dtsRE.test(file) ? file : `${tjsRE.test(file) ? file.replace(tjsRE, '') : file}.d.ts`
)
- if (dtsRE.test(file)) {
+ if (dtsRE.test(file) && !file.startsWith('\0')) {
sourceDtsFiles.add(project.addSourceFileAtPath(file))
}
}) |
请问你是在什么环境下出现了这个问题? |
RHEL 7.3 vite 2.7.10 主要就这些. |
我使用了相同的环境创建了一个简单的项目,无法复现你描述的问题,还是希望你能提供一下可复现的测试仓库。 或者你的项目中是否有一些不同于传统 vite+vue+ts 的项目的用法,如 |
好。我稍后整理一个发上来。 |
测试工程:vite-plugin-dts-test.zip 我又实验了一下,vite.config.ts 里面,设置 build.rollupOptions.external 的时候,不同的方式会有不同的结果。 |
同样的问题,我没有设置 按照 @chrisxvin 的修改,过滤掉以 |
为某个使用了 devextreme-vue 的组件生成 dts 时报错,内容如下:
但其实 dts 已经生成出来了。
报错的根源不知道。我跟踪出来的是
\x00commonjsHelpers.js
这个"文件"存在于 vite 里,包含在某个vite/dist/node/chunks/dep-xxx.js
中,仅仅是个声明:我修改了一下 dts 插件,简单过滤了一下,不添加这些
\0
开头的文件。The text was updated successfully, but these errors were encountered: