Skip to content

[Bug]: performance.chunkSplit is not working for Node.js libraries #354

@xc2

Description

@xc2

Version

  System:
    OS: macOS 15.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 142.00 MB / 32.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Browsers:
    Chrome: 130.0.6723.70
    Safari: 18.1
  npmPackages:
    @rslib/core: ^0.0.15 => 0.0.15

Details

rslib config

rslib.config.ts
import { defineConfig } from "@rslib/core";

export default defineConfig({
  output: { cleanDistPath: true },
  lib: [
    {
      format: "cjs",
      syntax: "es2021",
      dts: false,
      autoExternal: false,
      autoExtension: false,
      source: {
        entry: {
          bun: "./binary/bun.ts",
          node: "./binary/node.ts",
        },
      },
      performance: {
        chunkSplit: {
          strategy: "custom",
          splitChunks: {
            cacheGroups: {
              sources: {
                test: /./,
                name: "sources",
                enforce: true,
                chunks: "all",
                reuseExistingChunk: true,
              },
            },
          },
        },
      },
      output: {
        externals: {
          url: "node:url",
          buffer: "node:buffer",
          events: "node:events",
        },
        minify: true,
        cleanDistPath: false,
        target: "node",
        distPath: {
          root: "releases/binary",
          jsAsync: "internal",
        },
      },
    },
  ],
});

Inspect

Only chunks: 'async' is in rspack config

// rspack.config.mjs optimization.splitChunks
{ chunks: 'async' }

Reproduce link

Reproduce Steps

Metadata

Metadata

Assignees

Labels

🐞 bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions