-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
714ccaf
commit 15354b8
Showing
3 changed files
with
33 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const webpack = require('webpack'); | ||
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer'); | ||
|
||
/** | ||
* Get the production webpack configuration, given an environment object. | ||
* | ||
* @param {Object} env | ||
* @returns {Object} | ||
*/ | ||
function getProductionConfig(env) { | ||
return ({ | ||
mode: 'production', | ||
devtool: 'source-map', | ||
plugins: [ | ||
// This allows us to interactively inspect JS bundle contents | ||
...(process.env.ANALYZE_BUNDLE === 'true' ? [new BundleAnalyzerPlugin()] : []), | ||
new webpack.DefinePlugin({ | ||
__REACT_WEB_CONFIG__: JSON.stringify(env), | ||
|
||
// React Native JavaScript environment requires the global __DEV__ variable to be accessible. | ||
// react-native-render-html uses variable to log exclusively during development. | ||
// See https://reactnative.dev/docs/javascript-environment | ||
__DEV__: false, | ||
}), | ||
], | ||
}); | ||
} | ||
|
||
module.exports = getProductionConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const {merge} = require('webpack-merge'); | ||
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer'); | ||
const dotenv = require('dotenv'); | ||
const common = require('./webpack.common.js'); | ||
const getProductionConfig = require('./productionConfig'); | ||
|
||
const env = dotenv.config({path: path.resolve(__dirname, '../../.env.production')}).parsed; | ||
|
||
module.exports = merge(common, { | ||
mode: 'production', | ||
devtool: 'source-map', | ||
plugins: [ | ||
// This allows us to interactively inspect JS bundle contents | ||
...(process.env.ANALYZE_BUNDLE === 'true' ? [new BundleAnalyzerPlugin()] : []), | ||
new webpack.DefinePlugin({ | ||
__REACT_WEB_CONFIG__: JSON.stringify(env), | ||
|
||
// React Native JavaScript environment requires the global __DEV__ variable to be accessible. | ||
// react-native-render-html uses variable to log exclusively during development. | ||
// See https://reactnative.dev/docs/javascript-environment | ||
__DEV__: false, | ||
}), | ||
], | ||
}); | ||
module.exports = merge(common, getProductionConfig(env)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const {merge} = require('webpack-merge'); | ||
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer'); | ||
const dotenv = require('dotenv'); | ||
const common = require('./webpack.common.js'); | ||
const getProductionConfig = require('./productionConfig'); | ||
|
||
const env = dotenv.config({path: path.resolve(__dirname, '../../.env.staging')}).parsed; | ||
|
||
module.exports = merge(common, { | ||
mode: 'production', | ||
devtool: 'source-map', | ||
plugins: [ | ||
// This allows us to interactively inspect JS bundle contents | ||
...(process.env.ANALYZE_BUNDLE === 'true' ? [new BundleAnalyzerPlugin()] : []), | ||
new webpack.DefinePlugin({ | ||
__REACT_WEB_CONFIG__: JSON.stringify(env), | ||
|
||
// React Native JavaScript environment requires the global __DEV__ variable to be accessible. | ||
// react-native-render-html uses variable to log exclusively during development. | ||
// See https://reactnative.dev/docs/javascript-environment | ||
__DEV__: false, | ||
}), | ||
], | ||
}); | ||
module.exports = merge(common, getProductionConfig(env)); |