Skip to content

Interoperability with resource hints #179

@ivany4

Description

@ivany4

Compilation breaks when webpack-subresource-integrity is used together with html-webpack-preconnect-plugin that injects <link rel="preconnect" href="..." /> tag. SRI plugin tries to download the given file (which in this case is not a file but origin domain for preconnecting) and fails with a very obscure error:

ERROR in   Error: ENOENT: no such file or directory, open '<output path>  <preconnect origin URL>'
- plugin.ts:374 Plugin.processTag
  [...]/[webpack-subresource-integrity]/plugin.ts:374:5

- plugin.ts:110 
  [...]/[webpack-subresource-integrity]/plugin.ts:110:30

- Array.forEach

- plugin.ts:110 Plugin.handleHwpBodyTags
  [...]/[webpack-subresource-integrity]/plugin.ts:110:10

- index.ts:183 
  [...]/[webpack-subresource-integrity]/index.ts:183:18


 - new Promise

I see the mentions of <link rel="preload"> in the documentation, but not other types.

I realize that other resource hints, described in this document, currently marked as a working draft. But they also work in some browsers: https://caniuse.com/?search=preconnect

Webpack 5.71.0
html-webpack-plugin 5.5.0
webpack-subresource-integrity 5.1.0
html-webpack-preconnect-plugin 1.2.1

This was not a problem with webpack-subresource-integrity v1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions