forked from shadowwalker/next-pwa
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(next-pwa): re-adjust
workboxOptions.exclude
defaults (#130)
[bump]
- Loading branch information
Showing
28 changed files
with
1,003 additions
and
749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@ducanh2912/next-pwa": minor | ||
--- | ||
|
||
feat(next-pwa): re-adjust `workboxOptions.exclude` defaults | ||
|
||
- This was long overdue, so here we are. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: Precaching | ||
type: Docs | ||
--- | ||
|
||
# Precaching | ||
|
||
## Default | ||
|
||
By default, this is set to `[/\/_next\/static\/.*(?<!\.p)\.woff2/, /\.map$/, /^manifest.*\.js$/]`. | ||
|
||
### Why? | ||
|
||
#### Fonts | ||
|
||
`next/font` includes all subsets out of the box. However, precaching all of them might be prove to be too heavy on the users' devices, so they have been excluded by default. | ||
|
||
#### `.map` files | ||
|
||
These files do not serve any purpose to the users. As such, the plugin does not precache them by default. | ||
|
||
#### `.manifest.*.js` files | ||
|
||
This is to make sure we don't precache, e.g., the precache manifest file, or other manifests that are commonly generated by webpack but not useful for the users. | ||
|
||
## JS files | ||
|
||
By default, all JS files are precached. However, this behaviour is not desired for larger apps. If your app fits this criterion, it is recommend that you | ||
manually filter out JS files that are not necessary. | ||
|
||
<Tabs> | ||
|
||
```js | ||
// title next.config.js | ||
const withPWA = require("@ducanh2912/next-pwa").default({ | ||
// Your other options, | ||
workboxOptions: { exclude: ["/some-js-files.js"] }, | ||
}); | ||
|
||
module.exports = withPWA({ | ||
// Your Next.js config | ||
}); | ||
``` | ||
|
||
```js | ||
// title next.config.mjs | ||
import withPWAInit from "@ducanh2912/next-pwa"; | ||
|
||
const withPWA = withPWAInit({ | ||
// Your other options, | ||
workboxOptions: { exclude: ["/some-js-files.js"] }, | ||
}); | ||
|
||
export default withPWA({ | ||
// Your Next.js config | ||
}); | ||
``` | ||
|
||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.