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
f0703f8e
Commit
f0703f8e
authored
Jan 31, 2018
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update preact example
parent
6db44f80
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
32 deletions
+7
-32
next.config.js
examples/using-preact/next.config.js
+2
-15
package.json
examples/using-preact/package.json
+4
-10
server.js
examples/using-preact/server.js
+1
-7
No files found.
examples/using-preact/next.config.js
View file @
f0703f8e
module
.
exports
=
{
const
withPreact
=
require
(
'@zeit/next-preact'
)
webpack
:
function
(
config
,
{
dev
})
{
// For the development version, we'll use React.
// Because, it supports react hot loading and so on.
if
(
dev
)
{
return
config
}
config
.
resolve
.
alias
=
{
module
.
exports
=
withPreact
()
'react'
:
'preact-compat/dist/preact-compat'
,
'react-dom'
:
'preact-compat/dist/preact-compat'
}
return
config
}
}
examples/using-preact/package.json
View file @
f0703f8e
...
@@ -7,16 +7,10 @@
...
@@ -7,16 +7,10 @@
"start"
:
"NODE_ENV=production node server.js"
"start"
:
"NODE_ENV=production node server.js"
},
},
"dependencies"
:
{
"dependencies"
:
{
"
module-alias"
:
"^2.0.0
"
,
"
@zeit/next-preact"
:
"0.0.4
"
,
"next"
:
"latest"
,
"next"
:
"latest"
,
"preact"
:
"^7.2.0"
,
"preact"
:
"8.2.7"
,
"preact-compat"
:
"^3.14.0"
,
"preact-compat"
:
"3.18.0"
"react"
:
"^16.0.0"
,
"react-dom"
:
"^16.0.0"
},
},
"license"
:
"ISC"
,
"license"
:
"ISC"
"devDependencies"
:
{
"react"
:
"~15.6.1"
,
"react-dom"
:
"~15.6.1"
}
}
}
examples/using-preact/server.js
View file @
f0703f8e
const
port
=
parseInt
(
process
.
env
.
PORT
,
10
)
||
3000
const
port
=
parseInt
(
process
.
env
.
PORT
,
10
)
||
3000
const
dev
=
process
.
env
.
NODE_ENV
!==
'production'
const
dev
=
process
.
env
.
NODE_ENV
!==
'production'
const
moduleAlias
=
require
(
'module-alias'
)
// For the development version, we'll use React.
require
(
'@zeit/next-preact/alias'
)()
// Because, it support react hot loading and so on.
if
(
!
dev
)
{
moduleAlias
.
addAlias
(
'react'
,
'preact-compat'
)
moduleAlias
.
addAlias
(
'react-dom'
,
'preact-compat'
)
}
const
{
createServer
}
=
require
(
'http'
)
const
{
createServer
}
=
require
(
'http'
)
const
{
parse
}
=
require
(
'url'
)
const
{
parse
}
=
require
(
'url'
)
...
...
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