Skip to content

Commit

Permalink
docs: update FAQ about internal error when rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Nov 30, 2023
1 parent 8ee76ae commit f70e5fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ This is an existing [TypeScript issue](https://github.com/microsoft/TypeScript/i
}
```

### `Internal Error` occurs when using `rollupTypes: true`

Refer to this [issue](https://github.com/microsoft/rushstack/issues/3875), it's due to a limitation of `@microsoft/api-extractor` or TypeScript resolver.

The main reason is that `baseUrl` is specified in `tsconfig.json` and non-standard paths are used directly when imported.

For example: `baseUrl: 'src'` is specified and importing from `<root>/src/components/index.ts` in `<root>/src/index.ts`, and `import 'components'` is used instead of `import './components'`.

Currently, you need to avoid the above situation, or use aliases instead (with the `paths` option).

## Options

```ts
Expand Down
10 changes: 10 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ export default defineConfig({
}
```

### `rollupTypes: true` 时出现 `Internal Error`

参考这个 [issue](https://github.com/microsoft/rushstack/issues/3875),这是由于 `@microsoft/api-extractor` 或者是 TypeScript 解析器的一些限制导致的。

主要原因在于 `tsconfig.json` 中指定了 `baseUrl` 并且在引入时直接使用非标准路径。

例如:指定了 `baseUrl: 'src'` 并且在 `<root>/src/index.ts` 中引入 `<root>/src/components/index.ts` 时使用了 `import 'components'` 而不是 `import './components'`

目前想要正常打包,需要规避上述情况,或使用别名代替(配合 `paths` 属性)。

## 选项

```ts
Expand Down

0 comments on commit f70e5fc

Please sign in to comment.