Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support rollup assets file names #413

Merged
merged 2 commits into from Dec 12, 2022
Merged

Conversation

userquin
Copy link
Member

By default dontCacheBustURLsMatching is using Vite assets file names (<name>.<hash>.<ext>) and it will change to align it with Rollup default assets naming (<name>-<hash>.<ext>): vitejs/vite#10878.

This PR just changes the regex to support both layouts.

@netlify
Copy link

netlify bot commented Nov 13, 2022

Deploy Preview for vite-plugin-pwa-legacy ready!

Name Link
🔨 Latest commit 44da9f0
🔍 Latest deploy log https://app.netlify.com/sites/vite-plugin-pwa-legacy/deploys/6371162581f33e0009dcd6fb
😎 Deploy Preview https://deploy-preview-413--vite-plugin-pwa-legacy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -76,7 +76,7 @@ export async function resolveOptions(options: Partial<VitePWAOptions>, viteConfi
globDirectory: outDirRoot,
offlineGoogleAnalytics: false,
cleanupOutdatedCaches: true,
dontCacheBustURLsMatching: /\.[a-f0-9]{8}\./,
dontCacheBustURLsMatching: /[.-][a-f0-9]{8}\./,
Copy link
Contributor

@benmccann benmccann Nov 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the . here (and below) needs to be escaped?

Copy link
Member Author

@userquin userquin Nov 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, in a character class (square brackets) any character except ^, -, ] or \ is a literal, and - requires escaping only if not the first nor last one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About the dot, IntelliJ showing a redundant escaping warning:

imagen

@antfu antfu merged commit d8d2d36 into main Dec 12, 2022
@userquin userquin deleted the userquin/feat-asset-file-names branch March 25, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants