Skip to content

Commit

Permalink
feat: Update configuring of compilation (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
NtskwK authored Sep 10, 2024
1 parent ab08291 commit 3c51e26
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/advanced/tree-shake.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export b1 = "B1";
`b2` is not used and will be removed in both `a.js` and `b.js`

## Configuring Tree Shake
Tree Shake is enabled in production mode by default, to disable tree shake, use `compilation.treeShake`:
Tree Shake is enabled in production mode by default, to disable tree shake, use `compilation.treeShaking`:

```ts title="farm.config.ts"
export default {
compilation: {
treeShake: false,
treeShaking: false,
},
};
```
Expand Down
2 changes: 1 addition & 1 deletion docs/config/configuring-farm.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default defineConfig({
lazyCompilation: false,
persistentCache: false,
minify: false,
treeShake: false
treeShaking: false
},
});
```
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/3-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pnpm add -D core-js@3
:::

## Configure Tree Shake and Minify
Production optimization like `treeShake` and `minify` are **disabled** by default in `development` for performance reasons, and **enabled** by default in `production`. But if `treeShake` or `minify` are configured manually, the default value will be used regardless of `development` or `production`.
Production optimization like `treeShaking` and `minify` are **disabled** by default in `development` for performance reasons, and **enabled** by default in `production`. But if `treeShaking` or `minify` are configured manually, the default value will be used regardless of `development` or `production`.

For details about tree shake and minify, see:
* [Tree Shake](/docs/advanced/tree-shake)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export b1 = "B1";

## 配置 Tree Shake

Tree Shake 默认在生产模式下启用,要禁用 tree Shake,请使用 `compilation. treeShake`
Tree Shake 默认在生产模式下启用,要禁用 tree Shake,请使用 `compilation. treeShaking`

```ts title="farm.config.ts"
export default {
compilation: {
treeShake: false,
treeShaking: false,
},
};
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default defineConfig({
lazyCompilation: false,
persistentCache: false,
minify: false,
treeShake: false
treeShaking: false
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pnpm add -D core-js@3
:::

## 配置 Tree Shake 和 Minify
出于性能原因,像`treeShake``minify`这样的生产优化在`development`中默认被`禁用`,而在`生产`中默认被`启用`。 但如果手动配置了`treeShake``minify`,则无论`development``productive`都将使用默认值。
出于性能原因,像`treeShaking``minify`这样的生产优化在`development`中默认被`禁用`,而在`生产`中默认被`启用`。 但如果手动配置了`treeShaking``minify`,则无论`development``productive`都将使用默认值。

有关 Tree Shake 和 Minify 的详细信息,请参阅:
* [Tree Shake](/docs/advanced/tree-shake)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tree Shake
Farm 支持 Tree Shake,在默认 Production 环境下自动开启。通过 `compilation.treeShake` 选项可控制开启或者关闭。
Farm 支持 Tree Shake,在默认 Production 环境下自动开启。通过 `compilation.treeShaking` 选项可控制开启或者关闭。

Tree Shake 时,会自动读取 package.json 中的 sideEffects 字段,有 sideEffect 的模块将不会进行 Tree Shake。

Expand Down Expand Up @@ -27,12 +27,12 @@ export b1 = "B1";
`b2`未使用,将在`a.js``b.js`中删除

## 配置 Tree Shake
默认情况下,在生产模式下启用 Tree Shake,要禁用 Tree Shake,请使用`compilation.treeShake`
默认情况下,在生产模式下启用 Tree Shake,要禁用 Tree Shake,请使用`compilation.treeShaking`

```ts title="farm.config.ts"
export default {
compilation: {
treeShake: false,
treeShaking: false,
},
};
```
Expand Down
6 changes: 3 additions & 3 deletions versioned_docs/version-0.x/features/tree-shake.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tree Shake
Farm supports Tree Shake, which is automatically enabled in the default Production environment. It can be turned on or off by the `compilation.treeShake` option.
Farm supports Tree Shake, which is automatically enabled in the default Production environment. It can be turned on or off by the `compilation.treeShaking` option.

During Tree Shake, the sideEffects field in package.json will be automatically read, and modules with sideEffects will not perform Tree Shake.

Expand Down Expand Up @@ -27,12 +27,12 @@ export b1 = "B1";
`b2` is not used and will be removed in both `a.js` and `b.js`

## Configuring Tree Shake
Tree Shake is enabled in production mode by default, to disable tree shake, use `compilation.treeShake`:
Tree Shake is enabled in production mode by default, to disable tree shake, use `compilation.treeShaking`:

```ts title="farm.config.ts"
export default {
compilation: {
treeShake: false,
treeShaking: false,
},
};
```
Expand Down

0 comments on commit 3c51e26

Please sign in to comment.