Skip to content

Commit

Permalink
resolve next config being deleted problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ymchun committed Aug 9, 2022
1 parent 9d28c3b commit 0ad2ea7
Show file tree
Hide file tree
Showing 16 changed files with 362 additions and 377 deletions.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ Update or create `next.config.js` with
``` javascript
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public'
}
module.exports = withPWA(nextConfig, {
dest: 'public'
})
```

Expand Down Expand Up @@ -223,15 +221,13 @@ There are options you can use to customize the behavior of this plugin by adding
```javascript
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public',
// disable: process.env.NODE_ENV === 'development',
// register: true,
// scope: '/app',
// sw: 'service-worker.js',
//...
}
module.exports = withPWA(nextConfig, {
dest: 'public',
// disable: process.env.NODE_ENV === 'development',
// register: true,
// scope: '/app',
// sw: 'service-worker.js',
//...
})
```

Expand Down
8 changes: 4 additions & 4 deletions examples/cache-on-front-end-nav/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public'
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public'
})
12 changes: 6 additions & 6 deletions examples/cookie/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public',
dynamicStartUrl: true, // this is same as default value
dynamicStartUrlRedirect: '/login' // recommend to config this for best user experience if your start-url redirects on first load
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public',
dynamicStartUrl: true, // this is same as default value
dynamicStartUrlRedirect: '/login' // recommend to config this for best user experience if your start-url redirects on first load
})
16 changes: 6 additions & 10 deletions examples/custom-ts-worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ You can customize the directory of your custom worker file by setting the `custo
``` javascript
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
customWorkerDir: 'serviceworker'
...
}
module.exports = withPWA(nextConfig, {
customWorkerDir: 'serviceworker'
...
})
```

Expand All @@ -38,11 +36,9 @@ Basically you need to create a file such as `worker.js` in `public` folder, then
``` javascript
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public',
importScripts: ['/worker.js']
}
module.exports = withPWA(nextConfig, {
dest: 'public',
importScripts: ['/worker.js']
})
```

Expand Down
8 changes: 4 additions & 4 deletions examples/custom-ts-worker/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public'
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public'
})
16 changes: 6 additions & 10 deletions examples/custom-worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ You can customize the directory of your custom worker file by setting the `custo
``` javascript
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
customWorkerDir: 'serviceworker'
...
}
module.exports = withPWA(nextConfig, {
customWorkerDir: 'serviceworker'
...
})
```

Expand All @@ -40,11 +38,9 @@ Basically you need to create a file such as `worker.js` in `public` folder, then
``` javascript
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public',
importScripts: ['/worker.js']
}
module.exports = withPWA(nextConfig, {
dest: 'public',
importScripts: ['/worker.js']
})
```

Expand Down
8 changes: 4 additions & 4 deletions examples/custom-worker/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public'
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public'
})
12 changes: 6 additions & 6 deletions examples/lifecycle/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public',
register: false,
skipWaiting: false
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public',
register: false,
skipWaiting: false
})
16 changes: 8 additions & 8 deletions examples/minimal/next.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
// pwa output folder
// dest: '.next/pwa'
//
// Other configurations:
// ...
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
// pwa output folder
// dest: '.next/pwa'
//
// Other configurations:
// ...
})
8 changes: 4 additions & 4 deletions examples/next-9/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public'
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public'
})
4 changes: 3 additions & 1 deletion examples/next-i18next/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const withPWA = require('next-pwa')

module.exports = withPWA({})
const nextConfig = {};

module.exports = withPWA(nextConfig, {})
8 changes: 4 additions & 4 deletions examples/next-image/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public'
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public'
})
20 changes: 10 additions & 10 deletions examples/offline-fallback-v2/next.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public',
fallbacks: {
image: '/static/images/fallback.png'
// document: '/other-offline', // if you want to fallback to a custom page other than /_offline
// font: '/static/font/fallback.woff2',
// audio: ...,
// video: ...,
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public',
fallbacks: {
image: '/static/images/fallback.png'
// document: '/other-offline', // if you want to fallback to a custom page other than /_offline
// font: '/static/font/fallback.woff2',
// audio: ...,
// video: ...,
}
})
10 changes: 5 additions & 5 deletions examples/offline-fallback/next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public',
swSrc: 'service-worker.js'
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public',
swSrc: 'service-worker.js'
})
8 changes: 4 additions & 4 deletions examples/web-push/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const withPWA = require('next-pwa')

module.exports = withPWA({
pwa: {
dest: 'public'
}
const nextConfig = {};

module.exports = withPWA(nextConfig, {
dest: 'public'
})

0 comments on commit 0ad2ea7

Please sign in to comment.