-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove define plugin in rspack-cli (#6219)
* chore: remove define plugin in rspack-cli * test: add test
- Loading branch information
1 parent
2fda4a2
commit 2456d69
Showing
5 changed files
with
29 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const long_name_should_be_minified = process.env.NODE_ENV; | ||
console.log(long_name_should_be_minified); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { readFile, run } from "../../utils/test-utils"; | ||
import { resolve } from "path"; | ||
|
||
it("should not have `process.env.NODE_ENV` when optimization.nodeEnv has been set", async () => { | ||
await run(__dirname, ["--mode", "production"]); | ||
const mainJs = await readFile(resolve(__dirname, "dist/main.js"), "utf-8"); | ||
expect(mainJs).toContain("process.env.NODE_ENV"); | ||
expect(mainJs).not.toContain("long_name_should_be_minified"); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/rspack-cli/tests/build/issue-6214/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const path = require("path"); | ||
|
||
/** @type {import('@rspack/cli').Configuration} */ | ||
module.exports = { | ||
mode: "development", // will be override to "production" by "--mode" | ||
entry: "./entry.js", | ||
output: { | ||
clean: true, | ||
path: path.resolve(__dirname, "dist") | ||
}, | ||
optimization: { | ||
nodeEnv: false | ||
} | ||
}; |
2456d69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
Threshold exceeded: ["10000_development-mode_hmr + exec","10000_production-mode + exec"]
2456d69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open