-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: The output code contains an incorrect moduleId when using a ternary inside a require call #7139
Labels
Comments
Moving it outside results in a warning and the output code does not contain the code from the file I require.
Perhaps that will be fixed by #6963? |
This does not work and produces the warning above const importPath =
process.env.NODE_ENV !== "production"
? "../node_modules/react-dom/cjs/react-dom-server-legacy.browser.development"
: "../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js";
const ReactDOMServer = require(importPath); This however does work. let ReactDOMServer;
if (process.env.NODE_ENV !== "production") {
ReactDOMServer = require("../node_modules/react-dom/cjs/react-dom-server-legacy.browser.development");
} else {
ReactDOMServer = require("../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js");
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
System Info
System:
OS: Windows 11 10.0.22631
CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900K
Memory: 11.63 GB / 63.58 GB
Binaries:
Node: 18.18.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (126.0.2592.87)
Internet Explorer: 11.0.22621.3527
Details
Doing the following
causes the output to have an extra p in the moduleId in the webpack_require call
It looks like this
Reproduce link
https://github.com/LinusCenterstrom/rspack-repro-buildfail/tree/68572c6b9d758b41aac18ed3ceffc9a215724e03
Reproduce Steps
yarn install
yarn build
check dist/index.js
The text was updated successfully, but these errors were encountered: