Typescript 导出具有多个入口点的库的声明
假设我正在导出一个具有如下文件结构的库Typescript 导出具有多个入口点的库的声明,typescript,Typescript,假设我正在导出一个具有如下文件结构的库 |__ src | |__ index.ts | |__ other-file.ts 我想把它当食物吃 import { something } from 'library' import { other } from 'library/other-file' 为了实现这一点,我应该如何构建输出 为了实现这一点,我应该如何构建输出 使用tsconfig.json具有outDir:lib/声明:true/包括:['src'] 使用将类似于: import
|__ src
| |__ index.ts
| |__ other-file.ts
我想把它当食物吃
import { something } from 'library'
import { other } from 'library/other-file'
为了实现这一点,我应该如何构建输出
为了实现这一点,我应该如何构建输出
使用tsconfig.json
具有outDir:lib
/声明:true
/包括:['src']
使用将类似于:
import { something } from 'library'
import { other } from 'library/lib/other-file'
更多
package.json
中的main
指向lib/index.js
,“文件夹路径”相对于根包文件夹?这是节点模块分辨率中的一些东西,到目前为止我从未注意到。
import { something } from 'library'
import { other } from 'library/lib/other-file'