Skip to content

[Bug]: file name formats like "[hash:2]/[hash:21]" makes rolldown panic #4017

@blixt

Description

@blixt

Reproduction link or steps

I wanted a short prefix apt for blob stores to be a bit more browsable (e.g. when looking for a specific file for whatever reason) but using hash twice doesn't seem to be supported.

What is expected?

I would expect "[hash:2]/[hash:21]" to turn into "ab/abcdef…"

What is actually happening?

Panic:

thread 'tokio-runtime-worker' panicked at crates/rolldown_utils/src/hash_placeholder.rs:97:5:
seed is too large
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
✗ Build failed in 3.29s
error during build:
seed is too large
Error: seed is too large

System Info

System:
    OS: macOS 15.3.2
    CPU: (16) arm64 Apple M3 Max
    Memory: 1.52 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.10.0 - /opt/homebrew/bin/node
    npm: 10.9.2 - /opt/homebrew/bin/npm
    bun: 1.2.5 - ~/.bun/bin/bun
  Browsers:
    Chrome: 134.0.6998.166
    Firefox Nightly: 135.0
    Safari: 18.3.1

Any additional comments?

This was the config:

const hashOutputFileNames = {
    assetFileNames: "[hash:2]/[hash:21].[ext]",
    chunkFileNames: "[hash:2]/[hash:21].js",
    entryFileNames: "[hash:2]/[hash:21].js",
};

export default defineConfig({
    plugins: [react(), tailwindcss()],
    base: "/s/",
    build: {
        // Use references from source code instead to ensure we use content hashing.
        copyPublicDir: false,
        // Make sure all files become content hashed.
        rollupOptions: {
            output: hashOutputFileNames,
        },
    },
    worker: {
        rollupOptions: {
            output: hashOutputFileNames,
        },
    },
    test: {
        globals: true,
        environment: "jsdom",
        include: ["**/*.{test,spec}.{ts,tsx}"],
    },
});

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions