Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
5be30aae
Commit
5be30aae
authored
Dec 31, 2019
by
Alejandro Garcia Anglada
Committed by
Luis Alvarez D
Dec 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support static export and server hosted build and update docs (#9783)
parent
b6d51314
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
11 deletions
+43
-11
README.md
examples/with-next-offline/README.md
+35
-7
next.config.js
examples/with-next-offline/next.config.js
+3
-1
package.json
examples/with-next-offline/package.json
+5
-3
No files found.
examples/with-next-offline/README.md
View file @
5be30aae
...
@@ -12,7 +12,7 @@ npx create-next-app --example with-next-offline with-next-offline-app
...
@@ -12,7 +12,7 @@ npx create-next-app --example with-next-offline with-next-offline-app
yarn create next-app
--example
with-next-offline with-next-offline-app
yarn create next-app
--example
with-next-offline with-next-offline-app
```
```
### Download
manually
### Download
Download the example:
Download the example:
...
@@ -21,20 +21,48 @@ curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2
...
@@ -21,20 +21,48 @@ curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2
cd
with-next-offline
cd
with-next-offline
```
```
Install it and run:
### Install dependecies
```
bash
```
bash
npm
install
npm
install
npm run dev
npm run
export
serve
-s
out
# or
# or
yarn
yarn
yarn dev
```
### Build
#### Static export
```
bash
npm run
export
# or
yarn
export
yarn
export
serve
-s
out
```
```
To serve it yourself, you can run:
```
bash
npx serve
-s
out
```
#### Server hosted
```
bash
npm run build
# or
yarn build
```
To serve it yourself, run:
```
bash
npm start
# or
yarn start
```
### Deploy
Deploy it to the cloud with
[
now
](
https://zeit.co/now
)
(
[download](https://zeit.co/download
)
)
Deploy it to the cloud with
[
now
](
https://zeit.co/now
)
(
[download](https://zeit.co/download
)
)
```
bash
```
bash
...
...
examples/with-next-offline/next.config.js
View file @
5be30aae
...
@@ -2,7 +2,9 @@ const withOffline = require('next-offline')
...
@@ -2,7 +2,9 @@ const withOffline = require('next-offline')
module
.
exports
=
withOffline
({
module
.
exports
=
withOffline
({
workboxOpts
:
{
workboxOpts
:
{
swDest
:
'static/service-worker.js'
,
swDest
:
process
.
env
.
NEXT_EXPORT
?
'service-worker.js'
:
'static/service-worker.js'
,
},
},
experimental
:
{
experimental
:
{
async
rewrites
()
{
async
rewrites
()
{
...
...
examples/with-next-offline/package.json
View file @
5be30aae
...
@@ -6,13 +6,15 @@
...
@@ -6,13 +6,15 @@
"dev"
:
"next"
,
"dev"
:
"next"
,
"build"
:
"next build"
,
"build"
:
"next build"
,
"start"
:
"next start"
,
"start"
:
"next start"
,
"export"
:
"
next build &&
next export"
"export"
:
"
cross-env NEXT_EXPORT=true next build && cross-env NEXT_EXPORT=true
next export"
},
},
"dependencies"
:
{
"dependencies"
:
{
"next"
:
"canary"
,
"next"
:
"canary"
,
"next-offline"
:
"4.0.6"
,
"next-offline"
:
"4.0.6"
,
"react"
:
"16.12.0"
,
"react"
:
"16.12.0"
,
"react-dom"
:
"16.12.0"
,
"react-dom"
:
"16.12.0"
"serve"
:
"11.2.0"
},
"devDependencies"
:
{
"cross-env"
:
"6.0.3"
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment