Col0ring / father-tsconfig-example

father monorepo 打包测试

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

father monorepo 打包测试

Usage

# install dependencies
$ pnpm install

根目录运行pnpm run build,查看packages/bar/dist/esm/index.d.ts,值为:

/// <reference types="react" />
export declare const bar = 1;
declare const widgets: {
  Foo: {
    component: import('react').FC<import('packages/foo/dist/esm').FooProps>;
  };
};
export default widgets;

修改packages/bar/tsconfig.json,添加baseUrl:'.',重新 build,查看packages/bar/dist/esm/index.d.ts,值为:

/// <reference types="react" />
export declare const bar = 1;
declare const widgets: {
  Foo: {
    component: import('react').FC<import('@examples/foo').FooProps>;
  };
};
export default widgets;

打包结果正确,但此时开发模式下@examples/foo ts 提示指向packages/foo/dist/esm/index.d.ts,预期是想基于最外层的 paths 做提示解析。

一个比较好的解决方案是 build 的时候采用另外的 tsconfig.json。

About

father monorepo 打包测试

License:MIT License


Languages

Language:TypeScript 65.3%Language:JavaScript 26.1%Language:Shell 8.6%