Skip to content

Commit aefea3a

Browse files
committed
Fix JSDocs for mangleErrorsPlugin
1 parent f01cbf4 commit aefea3a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/toolkit/scripts/mangleErrors.mts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ const evalToString = (ast) => {
3333
}
3434

3535
/**
36-
* Takes a `throw new error` statement and transforms it depending on the minify argument. Either option results in a
37-
* smaller bundle size in production for consumers.
36+
* Transforms a `throw new Error` statement based on the `minify` argument, resulting in a smaller bundle size
37+
* for consumers in production.
3838
*
39-
* If minify is enabled, we'll replace the error message with just an index that maps to an arrow object lookup.
39+
* If `minify` is enabled, the error message will be replaced with an index that maps to an object lookup.
4040
*
41-
* If minify is disabled, we'll add in a conditional statement to check the process.env.NODE_ENV which will output a
42-
* an error number index in production or the actual error message in development. This allows consumers using webpack
43-
* or another build tool to have these messages in development but have just the error index in production.
41+
* If `minify` is disabled, a conditional statement will be added to check `process.env.NODE_ENV`, which will output
42+
* an error number index in production or the actual error message in development. This allows consumers using Webpack
43+
* or another build tool to have these messages in development but only the error index in production.
4444
*
4545
* E.g.
4646
* Before:
@@ -51,9 +51,9 @@ const evalToString = (ast) => {
5151
* throw new Error(0);
5252
* throw new Error(1);
5353
*
54-
* After: (without minify):
55-
* throw new Error(node.process.NODE_ENV === 'production' ? 0 : "This is my error message.");
56-
* throw new Error(node.process.NODE_ENV === 'production' ? 1 : "This is a second error message.");
54+
* After (without minify):
55+
* throw new Error(process.env.NODE_ENV === 'production' ? 0 : "This is my error message.");
56+
* throw new Error(process.env.NODE_ENV === 'production' ? 1 : "This is a second error message.");
5757
*/
5858
export const mangleErrorsPlugin = (babel) => {
5959
const t = babel.types

0 commit comments

Comments
 (0)