1
我有一个打字稿项目,我想要发布它,我生成一个名为build的目录中的所有js文件,并且在一个名为声明的目录中的所有声明文件中,我不想在我的发布版本中包含.ts文件 我很奇怪,我怎么可以做到这一点,而不使用吞咽?发布打字稿包没有ts文件?
这里是我的tsconfig.json
{
"compilerOptions": {
"target": "es6",
"lib": ["es6", "dom"],
"types": ["reflect-metadata"],
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "build",
"declarationDir": "declaration"
},
"exclude": [
"node_modules"
]
}
和我的package.json:
{
"name": "data-layer",
"version": "1.1.4",
"description": "data access layer",
"main": "./build/index.js",
"types": "./declaration/index.d.ts",
...
感谢您的答复 因此,我创建.npmignore这样的: * .TS * d.ts 构建 声明 *登录 但不包括构建!。!。和发布的包中的声明目录 – user4092086
@ user4092086那么它们很可能位于您的gitignore文件中。 '.npmignore'只是从'.gitignore'扩展名列表 – smnbbrv
嗯试图从.gitignore中删除他们虽然.npmignore应该覆盖.gitignore – user4092086