diff --git a/client/config/env.js b/client/config/env.js deleted file mode 100644 index 4b55e7d8..00000000 --- a/client/config/env.js +++ /dev/null @@ -1,39 +0,0 @@ -const path = require('path'); - -// Make sure that including paths.js after env.js will read .env variables. -delete require.cache[require.resolve('../../shared/config/paths')]; - -// We support resolving modules according to `NODE_PATH`. -// This lets you use absolute paths in imports inside large monorepos: -// https://github.com/facebookincubator/create-react-app/issues/253. -// It works similar to `NODE_PATH` in Node itself: -// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders -// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. -// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. -// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 -// We also resolve them to make sure all tools using them work consistently. -const appDirectory = path.resolve(path.join(__dirname, '../..')); -process.env.NODE_PATH = (process.env.NODE_PATH || '') - .split(path.delimiter) - .filter((folder) => folder && !path.isAbsolute(folder)) - .map((folder) => path.resolve(appDirectory, folder)) - .join(path.delimiter); - -// Grab environment variables and prepare them to be -// injected into the application via DefinePlugin in Webpack configuration. -function getClientEnvironment() { - const raw = { - NODE_ENV: process.env.NODE_ENV || 'development', - }; - // Stringify all values so we can feed into Webpack DefinePlugin - const stringified = { - 'process.env': Object.keys(raw).reduce((env, key) => { - env[key] = JSON.stringify(raw[key]); - return env; - }, {}), - }; - - return {raw, stringified}; -} - -module.exports = getClientEnvironment; diff --git a/client/config/webpack.config.dev.js b/client/config/webpack.config.dev.js index a76521bb..97347dc8 100644 --- a/client/config/webpack.config.dev.js +++ b/client/config/webpack.config.dev.js @@ -3,17 +3,13 @@ const path = require('path'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); -const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const WebpackBar = require('webpackbar'); const eslintFormatter = require('react-dev-utils/eslintFormatter'); -const getClientEnvironment = require('./env'); const paths = require('../../shared/config/paths'); -const env = getClientEnvironment(); - module.exports = { - mode: process.env.NODE_ENV, + mode: 'development', module: { rules: [ { @@ -160,21 +156,11 @@ module.exports = { chunkFilename: 'static/js/[name].chunk.js', }, plugins: [ - // Makes some environment variables available in index.html. - // The base URI is available as %BASE_URI% in index.html, e.g.: - // - // In development, this will be an empty string. - new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw), // Generates an `index.html` file with the -