-
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.
- Loading branch information
1 parent
54e103e
commit 6cc1b48
Showing
4 changed files
with
29 additions
and
18 deletions.
There are no files selected for viewing
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 | ||
} | ||
}; |