mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Don't require package.json at runtime (#5321)
* Remove obsolete check in dev-server * Don’t require package.json at runtime Inline the Next.js version at publish time, so that there’s no runtime dependency for this
This commit is contained in:
parent
7f39aef912
commit
0461413348
15
.babelrc
15
.babelrc
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"presets": [
|
||||
"@babel/preset-env",
|
||||
"@babel/preset-react",
|
||||
"@babel/preset-flow"
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
["@babel/plugin-transform-runtime", {
|
||||
"corejs": 2
|
||||
}]
|
||||
]
|
||||
}
|
18
.babelrc.js
Normal file
18
.babelrc.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
module.exports = {
|
||||
'presets': [
|
||||
'@babel/preset-env',
|
||||
'@babel/preset-react',
|
||||
'@babel/preset-flow'
|
||||
],
|
||||
'plugins': [
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
['@babel/plugin-transform-runtime', {
|
||||
'corejs': 2
|
||||
}],
|
||||
['babel-plugin-transform-define', {
|
||||
'process.env.NEXT_VERSION': require('./package.json').version
|
||||
}]
|
||||
]
|
||||
}
|
|
@ -125,6 +125,7 @@
|
|||
"@zeit/next-typescript": "1.1.0",
|
||||
"babel-eslint": "9.0.0",
|
||||
"babel-jest": "23.4.2",
|
||||
"babel-plugin-transform-define": "1.3.0",
|
||||
"benchmark": "2.1.4",
|
||||
"cheerio": "0.22.0",
|
||||
"chromedriver": "2.42.0",
|
||||
|
|
|
@ -17,9 +17,6 @@ import * as asset from '../lib/asset'
|
|||
import * as envConfig from '../lib/runtime-config'
|
||||
import { isResSent } from '../lib/utils'
|
||||
|
||||
// We need to go up one more level since we are in the `dist` directory
|
||||
import pkg from '../../package'
|
||||
|
||||
export default class Server {
|
||||
constructor ({ dir = '.', staticMarkup = false, quiet = false, conf = null } = {}) {
|
||||
this.dir = resolve(dir)
|
||||
|
@ -192,7 +189,7 @@ export default class Server {
|
|||
}
|
||||
|
||||
if (this.nextConfig.poweredByHeader) {
|
||||
res.setHeader('X-Powered-By', `Next.js ${pkg.version}`)
|
||||
res.setHeader('X-Powered-By', 'Next.js ' + process.env.NEXT_VERSION)
|
||||
}
|
||||
return sendHTML(req, res, html, req.method, this.renderOpts)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue