Skip to content

[Bug]: Panic occurred at runtime: "should have filename for asset module" #10862

Open
@adauleu

Description

@adauleu

System Info

System:
OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 16.28 GB / 31.09 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: 1.22.22 - ~/.yarn/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
pnpm: 9.1.1 - ~/.local/share/pnpm/pnpm
bun: 1.0.2 - ~/.bun/bin/bun
Watchman: 4.9.0 - /usr/bin/watchman
Browsers:
Chrome: 136.0.7103.92

Details

I tried to migrate to RSPack v1.4.2 and I encountered the following message while trying to build my large React project

Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message:  should have filename for asset module
Location: crates/rspack_plugin_asset/src/lib.rs:787

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Here is my RsPack config:

{
  name: 'my-name',
  output: {
    uniqueName: 'my-name',
    path: '<path>/my-name/build',
    pathinfo: false,
    filename: 'js/[name]-[contenthash].js',
    chunkFilename: 'js/[name]-[contenthash].js',
    sourceMapFilename: '[file].map',
    assetModuleFilename: 'media/[name]-[hash][ext]',
    publicPath: 'auto',
    clean: true,
    hashDigestLength: 32
  },
  mode: 'production',
  bail: true,
  devtool: 'source-map',
  module: {
    parser: { javascript: [Object] },
    rules: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  resolve: {
    extensions: [ '.ts', '.tsx', '.js', '.jsx' ],
    mainFields: [ 'module', 'browser', 'main' ],
    modules: [ 'node_modules', 'node_modules/@customLib' ],
    alias: {
      ...
    },
    symlinks: true
  },
  devServer: {
    hot: false,
    static: [ [Object], [Object] ],
    devMiddleware: { publicPath: '/', writeToDisk: true },
    port: 8490,
    host: '0.0.0.0',
    webSocketServer: 'sockjs',
    client: {
      webSocketURL: 'https://0.0.0.0:443/ws/my-name',
      webSocketTransport: 'sockjs',
      overlay: [Object],
      progress: true
    },
    allowedHosts: 'all',
    historyApiFallback: true
  },
  watchOptions: { ignored: [ '**/*.test.*', '**/node_modules' ] },
  performance: { hints: false },
  entry: {
    '<my-entry>': [
      '<path>/configs/rspack/entry/host-module.ts',
      '<path>/configs/rspack/entry/react-devtools.ts',
      '<path>/apps/my-name/src/index'
    ]
  },
  optimization: {
    minimize: true,
    minimizer: [
      [SwcJsMinimizerRspackPlugin],
      [LightningCssMinimizerRspackPlugin]
    ],
    splitChunks: { cacheGroups: [Object] }
  },
  plugins: [
    CssExtractRspackPlugin { options: [Object] },
    DefinePlugin {
      affectedHooks: 'compilation',
      name: 'DefinePlugin',
      _args: [Array]
    },
    { apply: [Function: apply] },
    ProvidePlugin {
      affectedHooks: 'compilation',
      name: 'ProvidePlugin',
      _args: [Array]
    },
    WebpackManifestPlugin { options: [Object] },
    ModuleFederationPluginV1 { _options: [Object] }
  ]
}

Reproduce link

No response

Reproduce Steps

Run yarn rspack on my project folder

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions