@redhat-cloud-services/frontend-components-config 4.6.25 → 4.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -2
- package/src/config.js +21 -5
- package/src/config.test.js +1 -0
- package/src/plugins.js +9 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redhat-cloud-services/frontend-components-config",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.26",
|
|
4
4
|
"description": "Config plugins and settings for RedHat Cloud Services project.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/RedHatInsights/frontend-components/tree/master/packages/config#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@
|
|
23
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.8",
|
|
24
|
+
"@redhat-cloud-services/frontend-components-config-utilities": "^1.5.24",
|
|
24
25
|
"assert": "^2.0.0",
|
|
25
26
|
"axios": "^0.27.2",
|
|
26
27
|
"babel-loader": "^8.2.5",
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"lodash": "^4.17.21",
|
|
46
47
|
"path-browserify": "^1.0.1",
|
|
47
48
|
"process": "^0.11.10",
|
|
49
|
+
"react-refresh": "^0.14.0",
|
|
48
50
|
"sass": "^1.55.0",
|
|
49
51
|
"sass-loader": "^11.1.1",
|
|
50
52
|
"source-map-loader": "^3.0.1",
|
package/src/config.js
CHANGED
|
@@ -41,8 +41,9 @@ module.exports = ({
|
|
|
41
41
|
useDevBuild = true,
|
|
42
42
|
useCache = false,
|
|
43
43
|
cacheConfig = {},
|
|
44
|
+
_unstableHotReload = false,
|
|
44
45
|
} = {}) => {
|
|
45
|
-
const filenameMask = `js/[name]${useFileHash ? `.${Date.now()}.[fullhash]` : ''}.js`;
|
|
46
|
+
const filenameMask = `js/[name]${!_unstableHotReload && useFileHash ? `.${Date.now()}.[fullhash]` : ''}.js`;
|
|
46
47
|
if (betaEnv) {
|
|
47
48
|
env = `${betaEnv}-beta`;
|
|
48
49
|
console.warn('betaEnv is deprecated in favor of env');
|
|
@@ -75,15 +76,29 @@ module.exports = ({
|
|
|
75
76
|
},
|
|
76
77
|
}
|
|
77
78
|
: {}),
|
|
78
|
-
entry:
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
entry: _unstableHotReload
|
|
80
|
+
? {
|
|
81
|
+
main: appEntry,
|
|
82
|
+
vendors: ['react', 'react-dom', 'react-refresh/runtime'],
|
|
83
|
+
}
|
|
84
|
+
: {
|
|
85
|
+
App: appEntry,
|
|
86
|
+
},
|
|
81
87
|
output: {
|
|
82
88
|
filename: filenameMask,
|
|
83
89
|
path: outputPath,
|
|
84
90
|
publicPath,
|
|
85
91
|
chunkFilename: filenameMask,
|
|
86
92
|
},
|
|
93
|
+
...(_unstableHotReload
|
|
94
|
+
? {
|
|
95
|
+
optimization: {
|
|
96
|
+
// for HMR all runtime chunks must be in a single file
|
|
97
|
+
runtimeChunk: 'single',
|
|
98
|
+
removeEmptyChunks: true,
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
: {}),
|
|
87
102
|
module: {
|
|
88
103
|
rules: [
|
|
89
104
|
{
|
|
@@ -179,7 +194,8 @@ module.exports = ({
|
|
|
179
194
|
port: devServerPort,
|
|
180
195
|
https: https || Boolean(useProxy),
|
|
181
196
|
host: '0.0.0.0', // This shares on local network. Needed for docker.host.internal
|
|
182
|
-
hot:
|
|
197
|
+
hot: _unstableHotReload, // Use livereload instead of HMR which is spotty with federated modules
|
|
198
|
+
liveReload: !_unstableHotReload,
|
|
183
199
|
allowedHosts: 'all',
|
|
184
200
|
// https://github.com/bripkens/connect-history-api-fallback
|
|
185
201
|
historyApiFallback: {
|
package/src/config.test.js
CHANGED
package/src/plugins.js
CHANGED
|
@@ -7,6 +7,7 @@ const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin');
|
|
|
7
7
|
const ChunkMapperPlugin = require('@redhat-cloud-services/frontend-components-config-utilities/chunk-mapper');
|
|
8
8
|
const jsVarName = require('@redhat-cloud-services/frontend-components-config-utilities/jsVarName');
|
|
9
9
|
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
10
|
+
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
10
11
|
const { glob } = require('glob');
|
|
11
12
|
const path = require('path');
|
|
12
13
|
|
|
@@ -21,21 +22,24 @@ module.exports = ({
|
|
|
21
22
|
plugins,
|
|
22
23
|
useChromeTemplate = true,
|
|
23
24
|
definePlugin = {},
|
|
25
|
+
_unstableHotReload = false,
|
|
26
|
+
useFileHash = true,
|
|
24
27
|
} = {}) => {
|
|
25
28
|
const hasTsConfig = glob.sync(path.resolve(rootFolder, './{tsconfig.json,!(node_modules)/**/tsconfig.json}')).length > 0;
|
|
29
|
+
const fileHash = !_unstableHotReload && useFileHash;
|
|
26
30
|
return [
|
|
27
31
|
...(generateSourceMaps
|
|
28
32
|
? [
|
|
29
33
|
new SourceMapDevToolPlugin({
|
|
30
34
|
test: 'js',
|
|
31
35
|
exclude: /(node_modules|bower_components)/i,
|
|
32
|
-
filename: 'sourcemaps/[name].[contenthash].js.map',
|
|
36
|
+
filename: fileHash ? 'sourcemaps/[name].js.map' : 'sourcemaps/[name].[contenthash].js.map',
|
|
33
37
|
}),
|
|
34
38
|
]
|
|
35
39
|
: []),
|
|
36
40
|
new MiniCssExtractPlugin({
|
|
37
|
-
chunkFilename: 'css/[name].[contenthash].css',
|
|
38
|
-
filename: 'css/[name].[contenthash].css',
|
|
41
|
+
chunkFilename: fileHash ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
42
|
+
filename: fileHash ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
39
43
|
ignoreOrder: true,
|
|
40
44
|
}),
|
|
41
45
|
new CleanWebpackPlugin({
|
|
@@ -69,8 +73,9 @@ module.exports = ({
|
|
|
69
73
|
process: 'process/browser.js',
|
|
70
74
|
Buffer: ['buffer', 'Buffer'],
|
|
71
75
|
}),
|
|
72
|
-
new ChunkMapperPlugin({ modules: [...(insights ? [jsVarName(insights.appname)] : []), ...(modules || [])] }),
|
|
76
|
+
new ChunkMapperPlugin({ _unstableHotReload, modules: [...(insights ? [jsVarName(insights.appname)] : []), ...(modules || [])] }),
|
|
73
77
|
...(hasTsConfig ? [new ForkTsCheckerWebpackPlugin()] : []),
|
|
74
78
|
...(plugins || []),
|
|
79
|
+
...(_unstableHotReload ? [new ReactRefreshWebpackPlugin()] : []),
|
|
75
80
|
];
|
|
76
81
|
};
|