diff --git a/src/helpers/copy.ts b/src/helpers/copy.ts index e7aeb1e..8154d5b 100644 --- a/src/helpers/copy.ts +++ b/src/helpers/copy.ts @@ -11,7 +11,11 @@ const filesWithDots = (name: string) => { case 'yarnrc': case 'npmrc': case 'editorconfig': - case 'babelrc': { + case 'babelrc': + case 'env.development': + case 'env.production': + case 'env': + case 'env.local': { return '.'.concat(name); } default: { diff --git a/templates/next/env.development b/templates/next/env.development new file mode 100644 index 0000000..e0bcdfa --- /dev/null +++ b/templates/next/env.development @@ -0,0 +1 @@ +NEXT_PUBLIC_IS_DEV=true \ No newline at end of file diff --git a/templates/next/env.production b/templates/next/env.production new file mode 100644 index 0000000..113e34c --- /dev/null +++ b/templates/next/env.production @@ -0,0 +1 @@ +NEXT_PUBLIC_IS_DEV=false \ No newline at end of file diff --git a/templates/next/next.config.js b/templates/next/next.config.js index 60b62b3..a67b1cb 100644 --- a/templates/next/next.config.js +++ b/templates/next/next.config.js @@ -1,27 +1,13 @@ /* eslint-disable @typescript-eslint/no-var-requires, - no-param-reassign, global-require */ -const { - PHASE_DEVELOPMENT_SERVER, -} = require('next/constants'); - -module.exports = (phase) => { - // Started in development mode `yarn dev` regardless of the value of STAGING environmental variable - const isDev = phase === PHASE_DEVELOPMENT_SERVER || process.env.NODE_ENV === 'development'; - - const env = { - IS_DEV: isDev, - }; - +module.exports = () => { const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', }); - return withBundleAnalyzer({ - env, - }); + return withBundleAnalyzer(); };