Skip to content

[Bug]: lost default params value when compressing #10474

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

Open
fi3ework opened this issue May 26, 2025 · 1 comment
Open

[Bug]: lost default params value when compressing #10474

fi3ework opened this issue May 26, 2025 · 1 comment
Assignees
Labels
team The issue/pr is created by the member of Rspack.

Comments

@fi3ework
Copy link
Member

System Info

Using 1.3.10 version of Rspack.

System:
OS: macOS 15.0.1
CPU: (14) arm64 Apple M3 Max
Memory: 283.58 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.7.0 - ~/Library/Caches/fnm_multishells/74108_1748231646341/bin/node
npm: 10.9.2 - ~/Library/Caches/fnm_multishells/74108_1748231646341/bin/npm
pnpm: 10.8.1 - ~/Library/Caches/fnm_multishells/73593_1748231644604/bin/pnpm
bun: 1.2.9 - ~/.bun/bin/bun
Browsers:
Chrome: 136.0.7103.114
Safari: 18.0.1

Details

When compress is enabled, there will an undefined lng variable which will cause a runtime error.

new class {
}().init({
    resources: {
        'zh-CN': {
            translation: {
                _created_in: "\uFF0C\u521B\u5EFA\u4E8E"
            }
        },
        'en-US': {
            translation: {
                _created_in: ', created'
            }
        }
    },
    lng
});
let a = 1;
export { a };

Reproduce link

https://github.com/fi3ework-reproduction/rspack-compress-bug

Reproduce Steps

  1. pnpm i
  2. check dist-difference or see rslib.config.ts to see toggle the compress field.
@fi3ework fi3ework added the pending triage The issue/PR is currently untouched. label May 26, 2025
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label May 26, 2025
@fi3ework
Copy link
Member Author

fi3ework commented May 27, 2025

Reproduced in SWC playground in 1.11.24 (link), while fixed in 1.11.29 (link), we could close this issue after SWC bumped.

@chenjiahan chenjiahan removed the pending triage The issue/PR is currently untouched. label May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

No branches or pull requests

3 participants