Skip to content

SRI compatibility with Nuxt 4 entryImportMap - integrity hash mismatch on dynamic imports #657

@alexieremia

Description

@alexieremia

Environment

- Operating System: Darwin
- Node Version:     v20.18.3
- Nuxt Version:     4.1.2
- CLI Version:      3.28.0
- Nitro Version:    2.12.6
- Package Manager:  [email protected]
- Builder:          -
- User Config:      extends, dir, i18n, cookies, nitro, compatibilityDate, vite
- Runtime Modules:  -
- Build Modules:    -

Nuxt Security Version

2.4.0

Default setup used?

Yes, the bug happens even if the security option is not customized

Security options

Reproduction

Description

The nuxt-security module's SRI (Subresource Integrity) feature is incompatible with Nuxt 4's new entryImportMap experimental feature, causing integrity hash mismatches and blocking dynamic imports.

Related issue nuxt/nuxt#33247

Additional context

When both SRI and entryImportMap are enabled, the following error occurs:

Failed to find a valid digest in the 'integrity' attribute for resource 'https://somedomain.com/_nuxt/PeQVlOgK.js' with computed SHA-384 integrity 'xBIudfkVkGKemQ5krLETsP8rpyEg97VDA7HctIzgdnTtoaRvTl6oYE5iCrzfVY5W'. The resource has been blocked.
Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: https://somedomain.com/_nuxt/PeQVlOgK.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions