Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add esbuild isolated modules links #4801

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ They have their own benefits.
- bundleless maintains the original file structure and is more conducive to debugging and tree shaking.

:::warning
bundleless is a single file compilation mode, so for type references and exports you need to add the `type` field, e.g. `import type { A } from '. /types`
bundleless is a single-file compilation mode, so for referencing and exporting types, you need to add the `type` keyword. For example, `import type { A } from './types'`. Please refer to the [esbuild documentation](https://esbuild.github.io/content-types/#isolated-modules) for more information.
:::

In `buildConfig` you can specify whether the current build task is bundle or bundleless by using [`buildConfig.buildType`](/en/api/config/build-config#buildtype).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sidebar_position: 1
- bundleless 则是可以保持原有的文件结构,更有利于调试和 tree shaking。

:::warning
bundleless 是单文件编译模式,因此对于类型的引用和导出你需要加上 `type` 字段, 例如 `import type { A } from './types`
bundleless 是单文件编译模式,因此对于类型的引用和导出你需要加上 `type` 字段, 例如 `import type { A } from './types`,背景参考 [esbuild 文档](https://esbuild.github.io/content-types/#isolated-modules)。
:::

在 `buildConfig` 中可以通过 [`buildConfig.buildType`](/api/config/build-config#buildtype) 来指定当前构建任务是 bundle 还是 bundleless。
Expand Down