Comments (8)
两次运行之间我均手动删除了
dist
文件夹的。我借了一台 mac 笔记本进行了测试,两次打包结果是一样且正常的,无法复现你描述的情况:
![]()
在vscode下可以,
因为我是用的webstorm ,就生成有问题...
...em
这是vscode
这是webstorm
from vite-plugin-dts.
我调整了 replaceFilePath
方法内的正则表达式:
const replaceFilePath = path => {
return path.replace(/packages[\\/][a-zA-z]+([\\/])/, '$1')
}
分别在根目录下执行 node build.js
和 node scripts/build.js
,在 dist
下得到了一样的结果:
from vite-plugin-dts.
emm, 实在抱歉,因为我没有配置打包前删除原有的dist目录 。
所以需要手动删除dist之后,重新偿试打包,我这边还是没有达到预期的效果。
也许跟系统环境有关?(我的环境:macOS Big Sur 11.6.1 )
from vite-plugin-dts.
两次运行之间我均手动删除了 dist
文件夹的。
我借了一台 mac 笔记本进行了测试,两次打包结果是一样且正常的,无法复现你描述的情况:
from vite-plugin-dts.
补充,在windows下的webstorm中。执行build.js一样会只生成index.d.ts。其它的还是不见。
但是如果使用node script/build.js 是能正常的生成完全的.d.ts.
所以, 暂时不确定到底是ws的node换环境的问题还是插件的兼容问题。
因为在ws中运行 script/build.js是执行的"C:\Program Files\nodejs\node.exe" E:\myself\vue3-library\build.js (windows下)
from vite-plugin-dts.
最新,经调试发现,在webstorm中运行时,有路径对不上,所以没有生成
执行根目录下的build.js
执行非根目录下的build
向上寻找对应的地方创建project对象时
是否可能因为创建ts-morph的实例时outDir路径写死的原因?
from vite-plugin-dts.
可能在 webstorm 执行 scripts/build.js
时 cwd
被设置为 scripts
目录了,你可以尝试一下使用 root
选项将根目录显式地设置为项目根目录。
PS:如果是 cwd
被设置为 scripts
目录,我也不确定会不会影响到 typescript
的输出路径(ts-morpth
内部依然是使用 typescript
的方法的)
from vite-plugin-dts.
可能在 webstorm 执行
scripts/build.js
时cwd
被设置为scripts
目录了,你可以尝试一下使用root
选项将根目录显式地设置为项目根目录。PS:如果是
cwd
被设置为scripts
目录,我也不确定会不会影响到typescript
的输出路径(ts-morpth
内部依然是使用typescript
的方法的)
我也是这样想的,上面调试的时候已经显示的设置了root
的路径。因为之前没有显示设置的时候,获取组件路径就是错的。修证过后,才验证才出现上面的我说的情况。
这个问题,我先关闭了。不去深究了。因为打包时,究终会在package.json
里设置命令,使用 node script/build.js 去执行。
这样的结果反而是对的。 : (
from vite-plugin-dts.
Related Issues (20)
- Error: ENOTEMPTY: directory not empty, rmdir during rollup HOT 2
- Before .ts analysed hook HOT 4
- Wrong declaration file for union types with null or undefined HOT 2
- 现在源文件以.d.ts结尾的文件没法打包到dist目录中 HOT 2
- Support defineModel in Vue3.4
- The inferred type of 'default' cannot be named without a reference to '.pnpm/[email protected]/node_modules/vue'. This is likely not portable. A type annotation is necessary HOT 1
- Types compiled using alias that doesn't exist in package HOT 1
- Version 3.8.1 doesn't work with path aliases HOT 4
- imports inside module declaration are moved outside, which can break types HOT 1
- Default export missing when using `rollupTypes`
- Support `export * as _` syntax HOT 2
- Duplicate definition of types when multiple entrypoints HOT 4
- Errors being swallowed when `rollupTypes: true` HOT 2
- 【Regression】Library which use IterableIterator.entries() cause TS Error. HOT 2
- 升级 language-tools 到 2.0 HOT 1
- Wrong definition generations since 3.8.2 for
- feat: Add a way to get the TypeScript program instance
- 打包一个库的时候,defineProps问题 HOT 1
- 3.8.0+ Cannot build while excluding vite-env.d.ts
- Invalid imports in generated d.ts for project with tsconfig path alias defined for any module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-dts.