rspack-contrib/storybook-rsbuild

Production build with storybook-rsbuild fails v1.0.1-rc.3 due to source map construction error(?)

cmdcolin opened this issue · 8 comments

I tried building a storybook with the newly released v1.0.1 and it crashes with

$ storybook build
storybook v8.2.9

info => Cleaning outputDir: storybook-static
info => Loading presets
info => Building manager..
info => Manager built (101 ms)
info => Building preview..
info Addon-docs: using MDX3
info => Copying static files: public at storybook-static
● web ━━━━━━━━━━━━━━━━━━━━━━━━━ (70%) sealing asset processing                                        Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message:  called `Option::unwrap()` on a `None` value
Location: index.crates.io-6f17d22bba15001f/rspack_sources-0.3.0/src/helpers.rs:838

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Aborted (core dumped)
error Command failed with exit code 134.

the RUST_BACKTRACE didn't have any extra info but i looked at https://github.com/web-infra-dev/rspack-sources/blob/main/src/helpers.rs#L838C26-L842C43 and saw it was related to source mapping so i added

  rsbuildFinal: config => {
    config.output ||= {}
    config.output.assetPrefix = './'
    delete config.output.sourceMap
    return config
  },

and it worked. i like source maps but didn't strictly need them so this was fine. potentially we do some weird things in our repo, and it is open source and i can link it if interested

Rust dump is not an expected throwing way in Rspack. Could you provide a minimal reproduction to help addressing this? A linking will also help.

cc @SyMind, as you're optimizing sourcemap recently.
It seems possibly caused by rspack-soucrce as contains change of the bump between panic flip.

here is a somewhat minimized repro that is taken at least outside our monorepo environment

https://github.com/cmdcolin/storybook-rsbuild-source-map-error-repro

random extra note:

    "@rsbuild/core": "1.0.1-rc.2", <-- storybook:build worked
    "@rsbuild/core": "1.0.1-rc.3", <-- storybook:build gives reported error

Fixed by Rspack, we will release a new version tomorrow

awesome, thank you! i believe i can confirm it is fixed in v1.0.1-rc.4 :)

closed for now