admin管理员组文章数量:1405170
I've searched for this question and haven't found anything that fixes my issue. Here's the problem:
I've got a package called @clioplaylists/clio
that's using a src/
folder for all its code. I'm building the source code with typescript into the dist/
folder and copying package.json
over into it as well. I'm using "declaration": true
in my tsconfig.json file, so the types .d.ts
files are getting generated correctly in the dist/
folder. Then I tried running npm publish --access public
in the root directory of the project, which published everything, but once I tried and access it it's saying certain folders are imported like import * from '@clioplaylists/clio/dist/dataplane/...'
, and I don't want the /dist/
in there.
I tried cd
ing into the dist/
folder and running npm publish --access public
to publish my package only with the code in the dist/
folder (which has the package.json
file in there). Everything publishes fine, except when I import the @clioplaylists/clio
package in another project I can't import anything. Attached is a picture of what the editor says is inside import * from '@clioplaylists/clio/
What's the right way to publish my package such that all of my types files are included but the /dist/
folder is not included in the import path?
I've searched for this question and haven't found anything that fixes my issue. Here's the problem:
I've got a package called @clioplaylists/clio
that's using a src/
folder for all its code. I'm building the source code with typescript into the dist/
folder and copying package.json
over into it as well. I'm using "declaration": true
in my tsconfig.json file, so the types .d.ts
files are getting generated correctly in the dist/
folder. Then I tried running npm publish --access public
in the root directory of the project, which published everything, but once I tried and access it it's saying certain folders are imported like import * from '@clioplaylists/clio/dist/dataplane/...'
, and I don't want the /dist/
in there.
I tried cd
ing into the dist/
folder and running npm publish --access public
to publish my package only with the code in the dist/
folder (which has the package.json
file in there). Everything publishes fine, except when I import the @clioplaylists/clio
package in another project I can't import anything. Attached is a picture of what the editor says is inside import * from '@clioplaylists/clio/
What's the right way to publish my package such that all of my types files are included but the /dist/
folder is not included in the import path?
1 Answer
Reset to default 0Try below code in tsconfig.json
"declarationDir": "dist",
本文标签: javascriptHow can I export types for my npm package without dist in the package pathStack Overflow
版权声明:本文标题:javascript - How can I export types for my npm package without dist in the package path? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744878488a2630059.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论