Skip to content
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

Build Result is different when configure optimization and umd #3958

Open
TopGrd opened this issue Aug 15, 2023 · 2 comments
Open

Build Result is different when configure optimization and umd #3958

TopGrd opened this issue Aug 15, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@TopGrd
Copy link

TopGrd commented Aug 15, 2023

System Info

System Info
System:
OS: macOS 13.4.1
CPU: (8) x64 Apple M1
Memory: 33.23 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.20.0 - ~/git/nvs/default/bin/node
Yarn: 1.22.19 - ~/.npm-global/bin/yarn
npm: 8.10.0 - ~/.npm-global/bin/npm
pnpm: 7.26.3 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 115.0.5790.170
Chrome Canary: 118.0.5939.0
Safari: 16.5.1
npmPackages:
@rspack/cli: latest => 0.2.11
@rspack/plugin-minify: ^0.1.12 => 0.1.12
@rspack/plugin-node-polyfill: latest => 0.1.12

Details

Build error when building with library and optimization config at the same time. Uncaught ReferenceError: require is not defined

But when I remove the optimization configuration, every thing is ok.

When configuring the optimization, M and P are assigned the value of an object, so the subsequent require logic is executed.
image

image

When i remove the optimization config, module and exports is undefined, so the bottom logic is executed
image

Reproduce link

https://github.com/TopGrd/rspack-umd-bug

Reproduce Steps

npm i
npm run build
serve ./dist

@TopGrd TopGrd added bug Something isn't working pending triage The issue/PR is currently untouched. labels Aug 15, 2023
@hyf0 hyf0 removed the pending triage The issue/PR is currently untouched. label Sep 11, 2023
@hyf0 hyf0 added this to the Planned milestone Sep 11, 2023
@hardfist hardfist removed this from the Planned milestone Oct 6, 2023
Copy link

stale bot commented Dec 5, 2023

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Dec 5, 2023
@hardfist
Copy link
Contributor

hardfist commented Jul 2, 2024

@TopGrd can you help checkout whether this problem still exists using latest version

@stale stale bot removed the stale label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants