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 cding 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 cding 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?

Share Improve this question asked Mar 9 at 4:09 Ezra HenleyEzra Henley 3493 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try below code in tsconfig.json

"declarationDir": "dist",

本文标签: javascriptHow can I export types for my npm package without dist in the package pathStack Overflow