Skip to content

Commit

Permalink
chore: remove define plugin in rspack-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder committed Apr 12, 2024
1 parent 738d40f commit f74a754
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions packages/rspack-cli/src/rspack-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,6 @@ export class RspackCLI {
}
}

// Tells webpack to set process.env.NODE_ENV to a given string value.
// optimization.nodeEnv uses DefinePlugin unless set to false.
// optimization.nodeEnv defaults to mode if set, else falls back to 'production'.
// See doc: https://webpack.js.org/configuration/optimization/#optimizationnodeenv
// See source: https://github.com/webpack/webpack/blob/8241da7f1e75c5581ba535d127fa66aeb9eb2ac8/lib/WebpackOptionsApply.js#L563

// When mode is set to 'none', optimization.nodeEnv defaults to false.
if (item.mode !== "none") {
(item.plugins ||= []).push(
new rspackCore.DefinePlugin({
// User defined `process.env.NODE_ENV` always has highest priority than default define
"process.env.NODE_ENV": JSON.stringify(item.mode)
})
);
}

if (typeof item.stats === "undefined") {
item.stats = { preset: "errors-warnings", timings: true };
} else if (typeof item.stats === "boolean") {
Expand Down

0 comments on commit f74a754

Please sign in to comment.