diff --git a/packages/next-server/server/next-server.ts b/packages/next-server/server/next-server.ts index 54b15b49..22a544a2 100644 --- a/packages/next-server/server/next-server.ts +++ b/packages/next-server/server/next-server.ts @@ -224,7 +224,7 @@ export default class Server { } if (this.nextConfig.poweredByHeader) { - res.setHeader('X-Powered-By', 'Next.js ' + process.env.NEXT_VERSION) + res.setHeader('X-Powered-By', 'Next.js ' + process.env.__NEXT_VERSION) } return this.sendHTML(req, res, html) } diff --git a/packages/next-server/taskfile-typescript.js b/packages/next-server/taskfile-typescript.js index f200e935..cb1d460a 100644 --- a/packages/next-server/taskfile-typescript.js +++ b/packages/next-server/taskfile-typescript.js @@ -35,7 +35,7 @@ try { } // update file's data - file.data = Buffer.from(result.outputText.replace(/process\.env\.NEXT_VERSION/, `"${require('./package.json').version}"`), 'utf8') + file.data = Buffer.from(result.outputText.replace(/process\.env\.__NEXT_VERSION/, `"${require('./package.json').version}"`), 'utf8') }) } } catch (err) { diff --git a/packages/next/bin/next.ts b/packages/next/bin/next.ts index c4d1fc1e..515d04ba 100755 --- a/packages/next/bin/next.ts +++ b/packages/next/bin/next.ts @@ -37,7 +37,7 @@ const args = arg({ // Version is inlined into the file using taskr build pipeline if (args['--version']) { // tslint:disable-next-line - console.log(`Next.js v${process.env.NEXT_VERSION}`) + console.log(`Next.js v${process.env.__NEXT_VERSION}`) process.exit(0) } diff --git a/packages/next/build/webpack-config.js b/packages/next/build/webpack-config.js index 2c9efae0..c2475bf6 100644 --- a/packages/next/build/webpack-config.js +++ b/packages/next/build/webpack-config.js @@ -295,7 +295,7 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer {}, config.env ? Object.keys(config.env) .reduce((acc, key) => { - if (/^(?:NODE_\w+)|(?:NEXT_\w+)|(?:__\w+)|(?:CONFIG_BUILD_ID)|(?:PORT)$/.test(key.toUpperCase())) throw new Error(`Next.js config env cannot have key of ${key}`) + if (/^(?:NODE_.+)|(?:__.+)$/.test(key.toUpperCase())) throw new Error(`Next.js config env cannot have key of ${key}`) return { ...acc, ...{ [`process.env.${key}`]: JSON.stringify(config.env[key]) } diff --git a/packages/next/client/on-demand-entries-client.js b/packages/next/client/on-demand-entries-client.js index 210b102b..2f67e3df 100644 --- a/packages/next/client/on-demand-entries-client.js +++ b/packages/next/client/on-demand-entries-client.js @@ -20,7 +20,7 @@ export default async ({ assetPrefix }) => { } return new Promise(resolve => { - ws = new WebSocket(`${wsProtocol}://${hostname}:${process.env.NEXT_WS_PORT}${process.env.NEXT_WS_PROXY_PATH}`) + ws = new WebSocket(`${wsProtocol}://${hostname}:${process.env.__NEXT_WS_PORT}${process.env.__NEXT_WS_PROXY_PATH}`) ws.onopen = () => resolve() ws.onclose = () => { setTimeout(async () => { diff --git a/packages/next/server/hot-reloader.js b/packages/next/server/hot-reloader.js index deb31164..8e32b5ae 100644 --- a/packages/next/server/hot-reloader.js +++ b/packages/next/server/hot-reloader.js @@ -167,8 +167,8 @@ export default class HotReloader { addWsConfig (configs) { const { websocketProxyPath, websocketProxyPort } = this.config.onDemandEntries const opts = { - 'process.env.NEXT_WS_PORT': websocketProxyPort || this.wsPort, - 'process.env.NEXT_WS_PROXY_PATH': JSON.stringify(websocketProxyPath) + 'process.env.__NEXT_WS_PORT': websocketProxyPort || this.wsPort, + 'process.env.__NEXT_WS_PROXY_PATH': JSON.stringify(websocketProxyPath) } configs[0].plugins.push(new webpack.DefinePlugin(opts)) } diff --git a/packages/next/taskfile-typescript.js b/packages/next/taskfile-typescript.js index 39482e2e..2f4f5b89 100644 --- a/packages/next/taskfile-typescript.js +++ b/packages/next/taskfile-typescript.js @@ -40,7 +40,7 @@ try { if (file.base === 'next-dev.js') result.outputText = result.outputText.replace('// REPLACE_NOOP_IMPORT', `import('./noop');`) // update file's data - file.data = Buffer.from(result.outputText.replace(/process\.env\.NEXT_VERSION/, `"${require('./package.json').version}"`), 'utf8') + file.data = Buffer.from(result.outputText.replace(/process\.env\.__NEXT_VERSION/, `"${require('./package.json').version}"`), 'utf8') }) } } catch (err) {