Skip to content

Commit 26df5c3

Browse files
committed
Use react for production too
1 parent 9dce76a commit 26df5c3

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

next.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
module.exports = {
2+
exportPathMap () {
3+
return {
4+
"/": { page: "/" },
5+
}
6+
},
27
webpack: function (config, { dev }) {
38
// For the development version, we'll use React.
49
// Because, it supports react hot loading and so on.
5-
if (dev) {
10+
// if (dev) {
611
return config
7-
}
12+
// }
813

914
config.resolve.alias = {
10-
'react': 'preact-compat/dist/preact-compat',
11-
'react-dom': 'preact-compat/dist/preact-compat'
15+
'react': 'preact-compat',
16+
'react-dom': 'preact-compat'
1217
}
1318

1419
return config

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"babel-preset-es2015": "^6.24.1",
66
"next": "^4.1.4",
77
"preact": "^8.2.6",
8-
"preact-compat": "^3.14.0",
8+
"preact-compat": "^3.17.0",
99
"react": "^16.0.0",
1010
"react-dom": "^16.0.0",
1111
"react-key-handler": "^1.0.1",

server.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const port = parseInt(process.env.PORT, 10) || 3000
22
const dev = process.env.NODE_ENV !== 'production'
3-
const moduleAlias = require('module-alias')
3+
// const moduleAlias = require('module-alias')
44

55
// For the development version, we'll use React.
66
// Because, it support react hot loading and so on.
7-
if (!dev) {
8-
moduleAlias.addAlias('react', 'preact-compat')
9-
moduleAlias.addAlias('react-dom', 'preact-compat')
10-
}
7+
// if (!dev) {
8+
// moduleAlias.addAlias('react', 'preact-compat')
9+
// moduleAlias.addAlias('react-dom', 'preact-compat')
10+
// }
1111

1212
const { createServer } = require('http')
1313
const { parse } = require('url')

0 commit comments

Comments
 (0)