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]: Panic occurred at runtime. Message: content should be available #5938

Closed
krutoo opened this issue Mar 14, 2024 · 14 comments
Closed

[Bug]: Panic occurred at runtime. Message: content should be available #5938

krutoo opened this issue Mar 14, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@krutoo
Copy link

krutoo commented Mar 14, 2024

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

  1. clone repo https://github.com/krutoo/isomorph-bun-vs-node
  2. npm install
  3. npm run dev
  4. see error during build
@krutoo krutoo added bug Something isn't working pending triage The issue/PR is currently untouched. labels Mar 14, 2024
@krutoo krutoo changed the title [Bug]: [Bug]: Panic occurred at runtime. Message: content should be available Mar 14, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Mar 14, 2024

I was not able to reproduce this panic locally. Here's what I get:

❯ npm run build

> isomorph-bun-vs-node@0.0.0 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

@krutoo
Copy link
Author

krutoo commented Mar 14, 2024

@h-a-n-a I dont see errors like on your case, do you use ubuntu?

@krutoo
Copy link
Author

krutoo commented Mar 14, 2024

@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

@xc2
Copy link
Collaborator

xc2 commented Mar 14, 2024

@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
Copy link
Author

krutoo commented Mar 14, 2024

@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

@xc2 Folder "./tgz" in repo (sorry for wrong path in package.json, repo now is updated)

please also use npm run dev

@xc2
Copy link
Collaborator

xc2 commented Mar 14, 2024

just tried ubuntu 20.04(x86_64) and debian bookworm(arm64) with no luck to reproduce.

weird

@krutoo
Copy link
Author

krutoo commented Mar 14, 2024

Hmmm, i fully remove node_modules and reinstall it and it works, soory for taking your time

@krutoo krutoo closed this as completed Mar 14, 2024
@krutoo krutoo reopened this Mar 14, 2024
@krutoo
Copy link
Author

krutoo commented Mar 14, 2024

@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:
image

@xc2
Copy link
Collaborator

xc2 commented Mar 15, 2024

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:

  1. modify it to import( /* webpackIgnore: true */ "bun:jsc"): playground
  2. or turn jsc.preserveAllComments on for builtin:swc-loader: playground

#5775 this issue will also help

@xc2 xc2 removed the pending triage The issue/PR is currently untouched. label Mar 15, 2024
@krutoo
Copy link
Author

krutoo commented Mar 15, 2024

@xc2 thanks a lot but why string literal change the behavior?

@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Mar 15, 2024

@xc2 thanks a lot but why string literal change the behavior?

@krutoo That's not expected for us. We will fix this. ;-)

Copy link

stale bot commented May 14, 2024

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 May 14, 2024
@krutoo
Copy link
Author

krutoo commented May 16, 2024

bump

@stale stale bot removed the stale label May 16, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Jun 25, 2024

This was fixed in DefinePlugin refactor.

@h-a-n-a h-a-n-a closed this as completed Jun 25, 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