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
42f1d2ef
Commit
42f1d2ef
authored
May 09, 2017
by
Arunoda Susiripala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a way to customize the output directory.
parent
71296cce
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
next-export
bin/next-export
+16
-4
export.js
server/export.js
+1
-1
No files found.
bin/next-export
View file @
42f1d2ef
...
@@ -10,11 +10,13 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
...
@@ -10,11 +10,13 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const
argv
=
parseArgs
(
process
.
argv
.
slice
(
2
),
{
const
argv
=
parseArgs
(
process
.
argv
.
slice
(
2
),
{
alias
:
{
alias
:
{
h
:
'help'
,
h
:
'help'
,
v
:
'verbose'
v
:
'verbose'
,
o
:
'outdir'
},
},
boolean
:
[
'h'
],
boolean
:
[
'h'
],
default
:
{
default
:
{
v
:
false
v
:
false
,
o
:
null
}
}
})
})
...
@@ -24,11 +26,16 @@ if (argv.help) {
...
@@ -24,11 +26,16 @@ if (argv.help) {
Exports the application for production deployment
Exports the application for production deployment
Usage
Usage
$ next export <dir>
$ next export
[options]
<dir>
<dir> represents where the compiled dist folder should go.
<dir> represents where the compiled dist folder should go.
If no directory is provided, the dist folder will be created in the current directory.
If no directory is provided, the dist folder will be created in the current directory.
You can set a custom folder in config https://github.com/zeit/next.js#custom-configuration, otherwise it will be created inside '.next'
You can set a custom folder in config https://github.com/zeit/next.js#custom-configuration, otherwise it will be created inside '.next'
Options
-h - list this help
-v - run export with the verbose mode
-o - set the output dir (defaults to '.out')
`
)
`
)
process
.
exit
(
0
)
process
.
exit
(
0
)
}
}
...
@@ -48,7 +55,12 @@ if (!existsSync(join(dir, 'pages'))) {
...
@@ -48,7 +55,12 @@ if (!existsSync(join(dir, 'pages'))) {
printAndExit
(
'> Couldn
\'
t find a `pages` directory. Please create one under the project root'
)
printAndExit
(
'> Couldn
\'
t find a `pages` directory. Please create one under the project root'
)
}
}
exportApp
(
dir
,
{
verbose
:
argv
.
verbose
})
const
options
=
{
verbose
:
argv
.
verbose
,
outdir
:
argv
.
outdir
?
resolve
(
argv
.
outdir
)
:
resolve
(
dir
,
'.out'
)
}
exportApp
(
dir
,
options
)
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
error
(
err
)
console
.
error
(
err
)
process
.
exit
(
1
)
process
.
exit
(
1
)
...
...
server/export.js
View file @
42f1d2ef
...
@@ -9,7 +9,7 @@ import { printAndExit } from '../lib/utils'
...
@@ -9,7 +9,7 @@ import { printAndExit } from '../lib/utils'
export
default
async
function
(
dir
,
options
)
{
export
default
async
function
(
dir
,
options
)
{
dir
=
resolve
(
dir
)
dir
=
resolve
(
dir
)
const
outDir
=
join
(
dir
,
'.out'
)
const
outDir
=
options
.
outdir
const
nextDir
=
join
(
dir
,
'.next'
)
const
nextDir
=
join
(
dir
,
'.next'
)
if
(
!
existsSync
(
nextDir
))
{
if
(
!
existsSync
(
nextDir
))
{
...
...
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