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

[Bug]: Rspack cannot correctly recognize @ unobservable @ computed @ action and other decorative symbols in the mobx library #8768

Open
fandywen opened this issue Dec 19, 2024 · 6 comments
Labels
bug Something isn't working need reproduction pending triage The issue/PR is currently untouched.

Comments

@fandywen
Copy link

fandywen commented Dec 19, 2024

System Info

System Info
System:
MacBook Pro (13-inch, M1, 2020)
Memory:16 GB
Binaries:
Node: 18.15.0
npm: 9.5.0
Browsers:
Chrome: 131.0.6778.140

npmPackages:
@rspack/cli: ^1.1.6 => 1.1.6
@rspack/core: ^1.1.6 => 1.1.6
mobx:^5.15.7 => 5.15.7
mobx-react:^6.3.1 => 6.3.1
react:^17.0.1 => 17.0.1
react-dom:^17.0.1 => 17.0.1

Details

React +Mobx

The loader configuration is as follows
swc-loader Set decorators: true,Compile without any errors,But The menu bar is blank because the @unobservable @computed @action decoration symbol is not correctly recognized

Remove the @ unobservable @ computed @ action decoration from the code, and the page will display normally

{
test: /.(j|t)s(x)?$/,
exclude: /node_modules/,
loader: 'builtin:swc-loader',
options: {
// js/ts编译配置
jsc: {
parser: {
// 开启ts编译
syntax:'typescript',
// 开启tsx编译
tsx: true,
// 开启@装饰器编译
decorators: true,
// 动态import
dynamicImport: true,
},
transform: {
// react运行环境配置
react: {
// dev模式打开development启动react的开发模式
development: isDevelopment,
refresh: isDevelopment,
},
// stage 1 的旧版本class decorators
legacyDecorator: true,
// 支持 ts emitDecoratorMetadata
// decoratorMetadata: true,
},
},
},

Reproduce link

No response

Reproduce Steps

Compile without any errors
Image

But The menu bar is blank
Image

Remove the @ unobservable @ computed @ action decoration from the code, and the page will display normally
Image

@fandywen fandywen added bug Something isn't working pending triage The issue/PR is currently untouched. labels Dec 19, 2024
@SyMind
Copy link
Member

SyMind commented Dec 19, 2024

@fandywen which version mobx you used

@fandywen
Copy link
Author

@fandywen which version mobx you used
@SyMind mobx:5.15.7,mobx-react:6.3.1

@fandywen
Copy link
Author

@chenjiahan @inottn Boss, Can you help me investigate the reason?

@inottn
Copy link
Collaborator

inottn commented Dec 20, 2024

Need a reproduction repo.

@yee94
Copy link

yee94 commented Dec 24, 2024

SAME ISSUE!

Copy link
Contributor

Hello @fandywen, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need reproduction pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

4 participants