[Bug]: Panic occurred at runtime. Message: content should be available
System Info
System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
Memory: 25.24 GB / 31.21 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v20.11.0/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
pnpm: 8.15.2 - ~/.nvm/versions/node/v20.11.0/bin/pnpm
bun: 1.0.30 - ~/.bun/bin/bun
Browsers:
Chrome: 122.0.6261.128
npmPackages:
@rspack/cli: ^0.5.7 => 0.5.7
@rspack/core: ^0.5.7 => 0.5.7
Details
> rspack --watch
Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message: content should be available
Location: /build/crates/rspack_loader_runner/src/runner.rs:399
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 1 frame hidden ⋮
2: __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
Aborted (core dumped)
Thoughs
Maybe this is because package (@sima-land/isomorph) uses exports field
Reproduce link
https://github.com/krutoo/isomorph-bun-vs-node
Reproduce Steps
- clone repo https://github.com/krutoo/isomorph-bun-vs-node
-
npm install -
npm run dev - see error during build
I was not able to reproduce this panic locally. Here's what I get:
❯ npm run build
> [email protected] build
> rspack
ERROR in ./src/pages/authors/index.tsx
× Package subpath './preset/node-handler' is not defined by "exports" in /Users/bytedance/Projects/rspack-issue-reproduce/isomorph-bun-vs-node/node_modules/@sima-land/isomorph/package.json
ERROR in ./src/pages/posts/index.tsx
× Package subpath './preset/node-handler' is not defined by "exports" in /Users/bytedance/Projects/rspack-issue-reproduce/isomorph-bun-vs-node/node_modules/@sima-land/isomorph/package.json
Rspack compiled with 2 errors in 972 ms
@h-a-n-a I dont see errors like on your case, do you use ubuntu?
@h-a-n-a can you also make cat ./node_modules/@sima-land/isomorph/package.json | grep node-handler?
Because this export is defined in package.json
@krutoo please provide the sima-land-isomorph-0.0.0.tgz file.
public version of @sima-land/isomorph has no exports related to node-handler
@krutoo please provide the
sima-land-isomorph-0.0.0.tgzfile.public version of @sima-land/isomorph has no exports related to node-handler
@xc2 Folder "./tgz" in repo (sorry for wrong path in package.json, repo now is updated)
please also use npm run dev
just tried ubuntu 20.04(x86_64) and debian bookworm(arm64) with no luck to reproduce.
weird
Hmmm, i fully remove node_modules and reinstall it and it works, soory for taking your time
@xc2 @h-a-n-a i found that it was my stashed code
try this branch please (npm run dev)
https://github.com/krutoo/isomorph-bun-vs-node/tree/rspack-panic
here is my result:
thanks @krutoo it reproduces.
it is caused by code below
import( /* webpackIgnore: true */ `bun:jsc`)
swc will transform it into import("bun:jsc"); by default when the request is in template literals. playground
there're two approach to avoid:
- modify it to
import( /* webpackIgnore: true */ "bun:jsc"): playground - or turn
jsc.preserveAllCommentson forbuiltin:swc-loader: playground
#5775 this issue will also help
@xc2 thanks a lot but why string literal change the behavior?
@xc2 thanks a lot but why string literal change the behavior?
@krutoo That's not expected for us. We will fix this. ;-)
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!
bump
This was fixed in DefinePlugin refactor.