-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
The @nuxtjs/svg-sprite module is the cause of regenerating bundle file hashes on every build, even when no new SVG icons are added or modified. This behavior causes unnecessary cache invalidation and impacts performance. @farnabaz @harlan-zw
Current Behavior
- Bundle file hashes change on every build
- This occurs even when:
- No new SVG files are added
- No existing SVG files are modified
- No configuration changes are made
- Affects both development and production builds
Impact
-
Cache Invalidation
- Forces clients to download new assets on every deployment
- Defeats the purpose of content hashing for caching
- Increases bandwidth usage and load times
-
Deployment Issues
- CDN caches are invalidated unnecessarily
- Increased deployment times
- Higher storage costs due to duplicate assets
Expected Behavior
- Bundle hashes should only change when:
- New SVG files are added
- Existing SVG files are modified
- Module configuration is changed
- Unchanged SVG files should maintain the same hash across builds
Reproduction Steps
-
Clone the reproduction repository:
git clone https://github.com/raminjafary/nuxt-svg-sprite-module-repro cd nuxt-svg-sprite-module-repro -
Install dependencies:
pnpm install
-
Run the build multiple times:
pnpm build # Wait for build to complete pnpm build # Wait for build to complete pnpm build
-
Observe that the bundle hashes change between builds even though no SVG files or configurations were modified
Workaround (Not available)
Removing the @nuxtjs/svg-sprite module resolves the issue. However, this is not an ideal solution as it removes the SVG sprite functionality entirely. A proper fix should be implemented in the module itself to prevent unnecessary hash revving.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels