Skip to content

Commit

Permalink
Update v0 docs due to #7108
Browse files Browse the repository at this point in the history
  • Loading branch information
Khez committed Nov 29, 2024
1 parent 4584921 commit 12bf64e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions website/docs/en/plugins/webpack/define-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ if (!BROWSER_SUPPORTS_HTML5) require('html5shiv');
When defining values for `process` prefer `'process.env.NODE_ENV': JSON.stringify('production')` over `process: { env: { NODE_ENV: JSON.stringify('production') } }`. Using the latter will overwrite the `process` object which can break compatibility with some modules that expect other values on the process object to be defined.
:::

:::tip
Note that because the plugin does a direct text replacement, the value given to it must include **actual quotes** inside of the string itself. Typically, this is done either with alternate quotes, such as `'"production"'`, or by using `JSON.stringify('production')`.
:::

```js
if (!PRODUCTION) {
console.log('Debug info');
Expand Down
4 changes: 0 additions & 4 deletions website/docs/zh/plugins/webpack/define-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ if (!BROWSER_SUPPORTS_HTML5) require('html5shiv');
在为 `process` 定义值时,推荐使用 `'process.env.NODE_ENV': JSON.stringify('production')` 而不是 `process: { env: { NODE_ENV: JSON.stringify('production') } }`。使用后者会重写 `process` 对象,这可能会破坏对某些模块的兼容性,这些模块期望 process 对象上的其他值被定义。
:::

:::tip 提示
请注意,由于插件直接执行文本替换,因此提供给它的值必须包含字符串内部的实际引号。通常,这是通过使用交替引号,如 `'"production"'`,或使用 `JSON.stringify('production')` 来完成。
:::

```js
if (!PRODUCTION) {
console.log('Debug info');
Expand Down

0 comments on commit 12bf64e

Please sign in to comment.