Skip to content

[Bug]: TypeError: Cannot read properties of undefined (reading 'call') #12425

@Sheetaa

Description

@Sheetaa

System Info

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"

4.19.91-27.5.al7.x86_64

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
Stepping: 7
CPU MHz: 2500.000
BogoMIPS: 5000.00
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 36608K
NUMA node0 CPU(s): 0-3

Details

现象

页面打开时 js 报错白屏

Image

排查原因

chunk 919874 引用了 chunk 588802,但是 588802 不存在,实际对应的 chunk id 的是 366421,chunk id 引用和提供的不一致

Image Image

可以看下面搜索结果,正常情况下 chunk id 搜索结果至少有2个,1个定义,1个引用。而这2个 id 都只能搜出1个。588802只有引用,366421只有定义。

Image Image

排查难点

尝试回滚到出问题的代码提交版本,重新编译部署(多次部署确认),问题没有复现,并且查看 chunk id 和出问题时候不一致。也就是后续的正常部署 chunk id 都是稳定的,只有出问题的那次 id 不同。
新部署的 id 如下:

Image

环境信息

  • Node.js:22.13.0
  • Rspack:1.6.5
  • Rspack 核心配置:
{
  output: {
    path: path.resolve(ROOT_PATH, `dist/${packageName}`),
    publicPath: cdnUrl,
    filename: (pathData) => {
      if (pathData.chunk.name === 'runtime') {
        return `[name].${version}.js`;
      }
      return '[name].[chunkhash:8].js';
    },
    chunkFilename: '[name].[chunkhash:8].js',
    crossOriginLoading: 'anonymous',
  },
  optimization: {
    minimizer: [
      new rspack.SwcJsMinimizerRspackPlugin({
        minimizerOptions: {
          // remove warnings
          warnings: isProdEnv,
          // Drop console statements
          drop_console: isProdEnv,
        },
        extractComments: false,
      }),
      new CssMinimizerWebpackPlugin(),
    ],
    runtimeChunk: {
      name: 'runtime',
    },
  }
}

moduleId 和 chunkId 没有专门设置,使用的默认值 'deterministic'

Reproduce link

No response

Reproduce Steps

无法重新编译复现,这是最奇怪的点

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions