@@ -33,14 +33,14 @@ const evalToString = (ast) => {
33
33
}
34
34
35
35
/**
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.
38
38
*
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.
40
40
*
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.
44
44
*
45
45
* E.g.
46
46
* Before:
@@ -51,9 +51,9 @@ const evalToString = (ast) => {
51
51
* throw new Error(0);
52
52
* throw new Error(1);
53
53
*
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.");
57
57
*/
58
58
export const mangleErrorsPlugin = ( babel ) => {
59
59
const t = babel . types
0 commit comments