Skip to content

[Bug]: throw error when use performance.dnsPrefetch and security.sri together #5445

@SyMind

Description

@SyMind

Version

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 125.86 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 137.0.7151.105
    Safari: 17.0
  npmPackages:
    @rsbuild/core: ^1.3.22 => 1.3.22

Details

After creating a project with pnpm create rsbuild@latest, modifying rsbuild.config.mjs to enable SRI and add DNS prefetch causes a build error:

import { defineConfig } from '@rsbuild/core';

export default defineConfig({
    security: {
        sri: {
            enable: true
        },
    },
    performance: {
        dnsPrefetch: ['https://example.com'],
    }
});

Error Message:

× Error: [html-rspack-plugin]: ENOENT: no such file or directory, open '/x/https:/example.com'

Reproduce link

https://github.com/SyMind/rsbuild-bug-with-sir-and-dnsPrefetch

Reproduce Steps

  1. pnpm i
  2. pnpm dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions