Unverified Commit 71c15905 authored by Allison Suarez Miranda's avatar Allison Suarez Miranda Committed by GitHub

fix: fixed webpack 5 issue (#786)

* added plugin to fix webpack issue
Signed-off-by: 's avatarAllison Suarez Miranda <asuarezmiranda@lyft.com>

* install process
Signed-off-by: 's avatarAllison Suarez Miranda <asuarezmiranda@lyft.com>
parent 83cdd266
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
const path = require('path'); const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir); return path.join(__dirname, dir);
...@@ -61,7 +62,7 @@ module.exports = { ...@@ -61,7 +62,7 @@ module.exports = {
test: FONT_PATTERN, test: FONT_PATTERN,
use: 'file-loader', use: 'file-loader',
}, },
] ],
}, },
resolve: { resolve: {
extensions: RESOLVED_EXTENSIONS, extensions: RESOLVED_EXTENSIONS,
...@@ -74,4 +75,10 @@ module.exports = { ...@@ -74,4 +75,10 @@ module.exports = {
utils: PATHS.utils, utils: PATHS.utils,
}, },
}, },
plugins: [
// fix "process is not defined" error:
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
}; };
...@@ -31028,8 +31028,7 @@ ...@@ -31028,8 +31028,7 @@
"process": { "process": {
"version": "0.11.10", "version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
"dev": true
}, },
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.0", "version": "2.0.0",
...@@ -135,6 +135,7 @@ ...@@ -135,6 +135,7 @@
"jquery": "^3.5.0", "jquery": "^3.5.0",
"moment-timezone": "^0.5.31", "moment-timezone": "^0.5.31",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"process": "^0.11.10",
"react": "^16.13.1", "react": "^16.13.1",
"react-avatar": "^2.5.1", "react-avatar": "^2.5.1",
"react-bootstrap": "^0.32.4", "react-bootstrap": "^0.32.4",
......
...@@ -128,6 +128,10 @@ const config: webpack.Configuration = { ...@@ -128,6 +128,10 @@ const config: webpack.Configuration = {
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
new MomentLocalesPlugin(), // To strip all locales except “en” new MomentLocalesPlugin(), // To strip all locales except “en”
...htmlWebpackPluginConfig, ...htmlWebpackPluginConfig,
// fix "process is not defined" error:
new webpack.ProvidePlugin({
process: 'process/browser',
}),
], ],
optimization: { optimization: {
moduleIds: 'deterministic', moduleIds: 'deterministic',
......
...@@ -4,6 +4,8 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin'; ...@@ -4,6 +4,8 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import commonConfig from './webpack.common'; import commonConfig from './webpack.common';
const webpack = require('webpack');
export default merge(commonConfig, { export default merge(commonConfig, {
mode: 'development', mode: 'development',
devtool: 'inline-source-map', devtool: 'inline-source-map',
...@@ -11,6 +13,10 @@ export default merge(commonConfig, { ...@@ -11,6 +13,10 @@ export default merge(commonConfig, {
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: '[name].dev.css', filename: '[name].dev.css',
}), }),
// fix "process is not defined" error:
new webpack.ProvidePlugin({
process: 'process/browser',
}),
// new BundleAnalyzerPlugin() // Uncomment to check the bundle size on dev // new BundleAnalyzerPlugin() // Uncomment to check the bundle size on dev
], ],
output: { output: {
......
...@@ -3,6 +3,8 @@ import merge from 'webpack-merge'; ...@@ -3,6 +3,8 @@ import merge from 'webpack-merge';
import TerserPlugin from 'terser-webpack-plugin'; import TerserPlugin from 'terser-webpack-plugin';
import commonConfig from './webpack.common'; import commonConfig from './webpack.common';
const webpack = require('webpack');
export default merge(commonConfig, { export default merge(commonConfig, {
mode: 'production', mode: 'production',
optimization: { optimization: {
...@@ -19,5 +21,9 @@ export default merge(commonConfig, { ...@@ -19,5 +21,9 @@ export default merge(commonConfig, {
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: '[name].[contenthash].css', filename: '[name].[contenthash].css',
}), }),
// fix "process is not defined" error:
new webpack.ProvidePlugin({
process: 'process/browser',
}),
], ],
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment