Skip to content

Commit

Permalink
fix: disable ReactRefreshPlugin when production build (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrykingxyz authored Dec 7, 2023
1 parent 4c1d0cd commit f6ef729
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cases/10000/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module.exports = {
new rspack.HtmlRspackPlugin({
template: path.resolve(__dirname, "./index.html")
}),
new ReactRefreshPlugin()
],
!prod && new ReactRefreshPlugin()
].filter(Boolean),
module: {
rules: [
{
Expand Down
1 change: 1 addition & 0 deletions lib/addons/development-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Addon } from "./common.js";

export default class extends Addon {
async afterSetup(ctx) {
process.env.NODE_ENV = "development";
ctx.rspackArgs.push("build", "--mode", "development");
}
}
1 change: 1 addition & 0 deletions lib/addons/production-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Addon } from "./common.js";

export default class extends Addon {
async afterSetup(ctx) {
process.env.NODE_ENV = "production";
ctx.rspackArgs.push("build", "--mode", "production");
}
}

0 comments on commit f6ef729

Please sign in to comment.