打字稿未编译为自定义npm包

时间:2020-06-08 05:40:32

标签: typescript react-native npm bitbucket

实际上我在Bitbucket中托管了一个项目,该项目正在使用Typescript,并且我的react-native应用程序通过以下方式将其放在package.json文件中:

"@core": "git+https://bitbucket.org/agrostydevs/ag-core/src/master/",

@core项目在其tsconfig.json文件中包含以下配置:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "outDir": "./dist",
    "skipLibCheck": true,
    "declaration": true,
    "lib": ["es6", "dom"],
    "removeComments": true,
    "isolatedModules": true,
    "strict": true,
  },
  "include": ["lib"],
  "exclude": ["node_modules", "**/__tests__/*"]
}

这是package.json项目的@core

{
  "name": "core",
  "license": "MIT",
  "version": "1.0.0",
  "main": "dist/index.js",
  "author": "Germán Alzate",
  "scripts": {
    "build": "tsc",
    "prepare": "tsc"
  },
  "devDependencies": {
    "typescript": "^3.2.2"
  },
  "dependencies": {
    "@types/lodash": "^4.14.155",
    "@types/node": "10.3.4",
    "@types/react-redux": "^7.1.9",
    "@types/redux": "^3.6.0",
    "@types/redux-logger": "3.0.6",
    "lodash": "^4.17.15",
    "redux": "4.0.0",
    "redux-logger": "3.0.6",
    "redux-thunk": "^2.3.0"
  }
}

我在@core项目上的项目映射目录是这个。

- lib/
    - actions/
        - index.ts
    - reducers/
        - index.ts
    - services/
        - index.ts
    - entities/
        - index.ts
    - common/
        - index.ts
    - config.ts
    - index.ts
- package.json
- tsconfig.json

每次在我的react-native项目上调用yarn upgrade @core时,它不会在dist目录上编译。当我登录ls node_modules/@core/dist时,仅出现index.js并需要所有其他文件夹和文件,但是这些文件和文件夹没有出现,因此应用尝试获取这些文件时会抛出错误

有人可以帮助我吗?任何其他信息,请发表评论

0 个答案:

没有答案