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]: .js in package name fails the build (e.g. highlight.js) #6785

Closed
markmssd opened this issue Jun 12, 2024 · 3 comments · Fixed by #6783
Closed

[Bug]: .js in package name fails the build (e.g. highlight.js) #6785

markmssd opened this issue Jun 12, 2024 · 3 comments · Fixed by #6783
Assignees
Labels
bug Something isn't working

Comments

@markmssd
Copy link

System Info

System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Max
Memory: 2.63 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.14.0/bin/yarn
npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
pnpm: 7.28.0 - ~/Library/pnpm/pnpm
bun: 1.1.8 - ~/.bun/bin/bun
Browsers:
Chrome: 125.0.6422.142
Edge: 125.0.2535.92
Safari: 17.5
npmPackages:
@rspack/cli: ^0.7.0 => 0.7.2
@rspack/core: ^0.7.0 => 0.7.2

Details

I was trying to use react-syntax-highlighter or react-highlight, but the build was failing. After digging into it, it seems it's because both of them use highlight.js underneath.

Seems that because the package name has the extension .js in it, RSPack doesn't handle it properly and crashes with:

Screenshot 2024-06-12 at 3 01 03 PM

Reproduce link

https://github.com/markmssd/rspack-repro/tree/highlight.js

Reproduce Steps

git clone https://github.com/markmssd/rspack-repro/tree/highlight.js
npm install
npm run dev:rspack

This will fail with the above error, due to this import: https://github.com/markmssd/rspack-repro/blob/highlight.js/src/render.js#L1. If you simply comment this line, it will work fine.

@markmssd markmssd added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jun 12, 2024
@hulin32
Copy link
Contributor

hulin32 commented Jun 12, 2024

@markmssd seems this issue only happened in 0.7.2, you can use 0.7.1 first to bypass it now.

I tried your demo, It is the same for me, I am curious how the core team will debug this with almost no debug info.

I would appreciate if they could share that here and I can help to fix it, looks very interesting for me

cc @SyMind @JSerFeng

@markmssd
Copy link
Author

Hey you're right, it works with 0.7.1. Unfortunately we can't use that version neither, because it had another issue which is fixed in 0.7.2 :P

I bisected it to understand where exactly the issue got introduced. In 0.7.2-canary-c0c0fd3-20240607004432, it was working, then in 0.7.2-canary-3dcf0a9-20240607151650 it broke. Does that mean that 3dcf0a9 is the faulty commit? 🤔

@LingyuCoder
Copy link
Collaborator

This is a known issue and we are fixing it. It is caused by too much string operations in highlight.js, which led to rust stack overflow during compile time evaluation.

@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label Jun 13, 2024
@h-a-n-a h-a-n-a closed this as completed Jun 13, 2024
@h-a-n-a h-a-n-a linked a pull request Jun 13, 2024 that will close this issue
2 tasks
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

Successfully merging a pull request may close this issue.

4 participants