Skip to content

[Bug][SubresourceIntegrityPlugin]: missing sriExtractCssHashes when use splitChunks to merge all chunks except initial chunk into one css chunk #12683

@taozhou-glean

Description

@taozhou-glean

System Info

tried on rspack 1.6.5 and 1.6.6, have same issue

Details

we noticed an issue when we try to merge all our css chunks into one css file (excluding the main bundle entry chunk), that the sriExtractCssHashes is omitted entirely, which leads to blank page while injecting that other.css chunk: __webpack_require__.sriExtractCssHashes[chunkId] failed to access undefined with that chunkId

and even without this change, we noticed that not every css chunk we are loading has integrity attached, we have a few issues on integrity being undefined, not sure how to debug this further, but let me know if you need more info

Reproduce link

No response

Reproduce Steps

with rspack config + splitChunks:

   splitChunks: {
      otherStyles: {
        chunks: (chunk) => !excludedChunks.includes(chunk.name)
        enforce: true,
        minChunks: 1,
        name: 'async',
        priority: 10,
        type: 'css/mini-extract',
      },
     chunks: "async",
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending triageThe issue/PR is currently untouched.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions