@studyportals/webpack-helper 6.0.7-0 → 6.0.7-11
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
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studyportals/webpack-helper",
|
|
3
|
-
"version": "6.0.7-
|
|
3
|
+
"version": "6.0.7-11",
|
|
4
4
|
"description": "A collection of standard configurations and helpers for webpack.",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "vitest --watch=false --coverage",
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"prepublish": "npm run build",
|
|
10
|
-
"postinstall": "
|
|
10
|
+
"postinstall": "cp ./assets/.browserslistrc ../../../",
|
|
11
11
|
"deploy-beta": "npm version prerelease && npm run build && npm publish --tag beta --access=public --auth-type=legacy && rm -rf node_modules"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
@@ -3,22 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const mode_1 = require("../enums/mode");
|
|
4
4
|
const { RetryChunkLoadPlugin } = require('webpack-retry-chunk-load-plugin');
|
|
5
5
|
class ChunksRetryPluginFactory {
|
|
6
|
-
static
|
|
6
|
+
static IsPresetSupported(preset) {
|
|
7
|
+
if (!preset.retryChunksConfig)
|
|
8
|
+
return false;
|
|
9
|
+
if (preset.mode === mode_1.Mode.DEVELOPMENT)
|
|
10
|
+
return false;
|
|
11
|
+
if (!preset.retryChunksConfig.inject)
|
|
12
|
+
return false;
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
static GetRetryChunksPlugin(preset) {
|
|
7
16
|
if (!preset.retryChunksConfig) {
|
|
8
|
-
return
|
|
17
|
+
return;
|
|
9
18
|
}
|
|
10
19
|
if (preset.mode === mode_1.Mode.DEVELOPMENT) {
|
|
11
|
-
return
|
|
20
|
+
return;
|
|
12
21
|
}
|
|
13
22
|
if (!preset.retryChunksConfig.inject) {
|
|
14
|
-
return
|
|
23
|
+
return;
|
|
15
24
|
}
|
|
16
|
-
|
|
17
|
-
const plugins = preset.getPlugins(filename);
|
|
18
|
-
plugins.push(ChunksRetryPluginFactory.CustomRetryChunksPlugin(preset));
|
|
19
|
-
return plugins;
|
|
20
|
-
};
|
|
21
|
-
return preset;
|
|
25
|
+
return ChunksRetryPluginFactory.CustomRetryChunksPlugin(preset);
|
|
22
26
|
}
|
|
23
27
|
static CustomRetryChunksPlugin(preset) {
|
|
24
28
|
const { retryChunksConfig } = preset;
|
|
@@ -44,11 +48,11 @@ class ChunksRetryPluginFactory {
|
|
|
44
48
|
}
|
|
45
49
|
if (!retryChunksConfig.disableDefaultRollbarError) {
|
|
46
50
|
lastResortScript = `
|
|
47
|
-
if (!window || !window['
|
|
51
|
+
if (!window || !window['rollbar'] || !window['rollbar'].error) {
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
window['
|
|
55
|
+
window['rollbar'].error(new Error('Failed to load chunk for after retries'));
|
|
52
56
|
`;
|
|
53
57
|
}
|
|
54
58
|
return lastResortScript;
|
|
@@ -80,13 +80,16 @@ class Configuration {
|
|
|
80
80
|
}
|
|
81
81
|
injectPreset(preset) {
|
|
82
82
|
const plugins = preset.getPlugins(this.getCSSFileName());
|
|
83
|
+
if (chunks_retry_plugin_factory_1.default.IsPresetSupported(preset)) {
|
|
84
|
+
const retryPlugin = chunks_retry_plugin_factory_1.default.GetRetryChunksPlugin(preset);
|
|
85
|
+
plugins.push(retryPlugin);
|
|
86
|
+
}
|
|
83
87
|
const module = preset.getModule();
|
|
84
88
|
plugins.forEach(plugin => {
|
|
85
89
|
this.plugins.addPlugin(plugin);
|
|
86
90
|
});
|
|
87
91
|
this.extensions = this.extensions.concat(preset.getExtensions());
|
|
88
92
|
this.module.setModule(module);
|
|
89
|
-
chunks_retry_plugin_factory_1.default.InjectPlugin(preset);
|
|
90
93
|
}
|
|
91
94
|
getEnvironmentSpecificConfig(mode) {
|
|
92
95
|
return this.environmentSpecificConfig[mode];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|