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

@serwist/next - additionalPrecacheEntries prevents automatically precaching public dir files #139

Open
DuCanhGH opened this issue May 2, 2024 Discussed in #138 · 0 comments
Labels
enhancement New feature or request no stale This should not go stale Serwist v10 Planned changes for v10

Comments

@DuCanhGH
Copy link
Member

DuCanhGH commented May 2, 2024

Discussed in #138

Originally posted by jon-smith April 30, 2024
I'm using @serwist/next with a statically exported Next.js app and it's working well, but I'm confused about some precaching options and I'm unsure if it's an issue or I'm using it incorrectly.

I noticed that the index file doesn't get precached by default (I want to ensure this is in sync with the precached js/css files), so I have set up my init as follows:

const withSerwist = withSerwistInit({
	swSrc: 'src/app/sw.ts',
	swDest: 'public/sw.js',
	additionalPrecacheEntries: [{ url: '/', revision }],
});

However this then prevents some files in my public directory from being precached. I noticed in the code (https://github.com/serwist/serwist/blob/main/packages/next/src/index.ts#L165), globPublicPatterns is not used if additionalPrecacheEntries have been set. Is there a reason for this?

The simple workaround is to add my public files to additionalPrecacheEntries but I feel like I might be just using it wrong.

@DuCanhGH DuCanhGH added Serwist v10 Planned changes for v10 enhancement New feature or request no stale This should not go stale labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no stale This should not go stale Serwist v10 Planned changes for v10
Projects
None yet
Development

No branches or pull requests

1 participant