3
3
const webpack = require ( "webpack" ) ;
4
4
const HtmlWebpackPlugin = require ( "html-webpack-plugin" ) ;
5
5
const WebpackBuildNotifierPlugin = require ( "webpack-build-notifier" ) ;
6
- const ManifestPlugin = require ( "webpack-manifest-plugin" ) ;
6
+ const { WebpackManifestPlugin } = require ( "webpack-manifest-plugin" ) ;
7
7
const MiniCssExtractPlugin = require ( "mini-css-extract-plugin" ) ;
8
8
const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
9
9
const LessPluginAutoPrefix = require ( "less-plugin-autoprefix" ) ;
@@ -76,15 +76,21 @@ const config = {
76
76
publicPath : staticPath
77
77
} ,
78
78
node : {
79
- fs : "empty" ,
80
- path : "empty"
81
79
} ,
82
80
resolve : {
83
81
symlinks : false ,
84
82
extensions : [ ".js" , ".jsx" , ".ts" , ".tsx" ] ,
85
83
alias : {
86
84
"@" : appPath ,
87
85
extensions : extensionPath
86
+ } ,
87
+ fallback : {
88
+ fs : false ,
89
+ url : require . resolve ( "url/" ) ,
90
+ stream : require . resolve ( "stream-browserify" ) ,
91
+ assert : require . resolve ( "assert/" ) ,
92
+ util : require . resolve ( "util/" ) ,
93
+ process : require . resolve ( "process/browser" ) ,
88
94
}
89
95
} ,
90
96
plugins : [
@@ -109,7 +115,7 @@ const config = {
109
115
new MiniCssExtractPlugin ( {
110
116
filename : "[name].[chunkhash].css"
111
117
} ) ,
112
- new ManifestPlugin ( {
118
+ new WebpackManifestPlugin ( {
113
119
fileName : "asset-manifest.json" ,
114
120
publicPath : ""
115
121
} ) ,
@@ -122,7 +128,13 @@ const config = {
122
128
{ from : "client/app/assets/fonts" , to : "fonts/" }
123
129
] ,
124
130
} ) ,
125
- isHotReloadingEnabled && new ReactRefreshWebpackPlugin ( { overlay : false } )
131
+ isHotReloadingEnabled && new ReactRefreshWebpackPlugin ( { overlay : false } ) ,
132
+ new webpack . ProvidePlugin ( {
133
+ // Make a global `process` variable that points to the `process` package,
134
+ // because the `util` package expects there to be a global variable named `process`.
135
+ // Thanks to https://stackoverflow.com/a/65018686/14239942
136
+ process : 'process/browser'
137
+ } )
126
138
] . filter ( Boolean ) ,
127
139
optimization : {
128
140
splitChunks : {
@@ -137,6 +149,9 @@ const config = {
137
149
test : / \. j s $ / ,
138
150
enforce : "pre" ,
139
151
use : [ "source-map-loader" ] ,
152
+ resolve : {
153
+ fullySpecified : false
154
+ }
140
155
} ,
141
156
{
142
157
test : / \. ( t | j ) s x ? $ / ,
@@ -233,7 +248,7 @@ const config = {
233
248
}
234
249
]
235
250
} ,
236
- devtool : isProduction ? "source-map" : "cheap- eval-module-source-map" ,
251
+ devtool : isProduction ? "source-map" : "eval-cheap -module-source-map" ,
237
252
stats : {
238
253
children : false ,
239
254
modules : false ,
0 commit comments