piral-cli-webpack5 1.0.2 → 1.1.0-beta.5756
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/lib/helpers.js +13 -8
- package/lib/helpers.js.map +1 -1
- package/package.json +3 -3
- package/src/helpers.ts +14 -10
package/lib/helpers.js
CHANGED
|
@@ -5,15 +5,20 @@ const fs_1 = require("fs");
|
|
|
5
5
|
function extendConfig([webPackConfig, enhancer], otherConfigPath, overrides = {}) {
|
|
6
6
|
const original = webPackConfig;
|
|
7
7
|
if ((0, fs_1.existsSync)(otherConfigPath)) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
try {
|
|
9
|
+
const otherConfig = require(otherConfigPath);
|
|
10
|
+
if (typeof otherConfig === 'function') {
|
|
11
|
+
webPackConfig = otherConfig(webPackConfig);
|
|
12
|
+
}
|
|
13
|
+
else if (typeof otherConfig === 'object') {
|
|
14
|
+
webPackConfig = Object.assign(Object.assign({}, webPackConfig), otherConfig);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
console.warn(`Did not recognize the export from "${otherConfigPath}". Skipping.`);
|
|
18
|
+
}
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
console.warn(`Did not recognize the export from "${otherConfigPath}". Skipping.`);
|
|
20
|
+
catch (ex) {
|
|
21
|
+
console.error(`Error while using the config from "${otherConfigPath}": ${ex}`);
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
['entry', 'output', 'optimization'].forEach((s) => {
|
package/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAAA,2BAAgC;AAIhC,SAAgB,YAAY,CAC1B,CAAC,aAAa,EAAE,QAAQ,CAAuB,EAC/C,eAAuB,EACvB,YAA2B,EAAE;IA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 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli-webpack5",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-beta.5756",
|
|
4
4
|
"description": "Provides debug and build capabilities for pilets and Piral instances using Webpack v5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral-cli",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/node": "18.0.1",
|
|
50
50
|
"@types/terser-webpack-plugin": "^5.2.0",
|
|
51
51
|
"@types/yargs": "^15.0.4",
|
|
52
|
-
"piral-cli": "
|
|
52
|
+
"piral-cli": "1.1.0-beta.5756",
|
|
53
53
|
"strip-ansi": "^6.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"ts-loader": "^9.4.2",
|
|
77
77
|
"webpack": "^5.82.1"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "ad2e5ac36a0a293629c4e73fb609f604895d7e52"
|
|
80
80
|
}
|
package/src/helpers.ts
CHANGED
|
@@ -10,17 +10,21 @@ export function extendConfig(
|
|
|
10
10
|
const original = webPackConfig;
|
|
11
11
|
|
|
12
12
|
if (existsSync(otherConfigPath)) {
|
|
13
|
-
|
|
13
|
+
try {
|
|
14
|
+
const otherConfig = require(otherConfigPath);
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
if (typeof otherConfig === 'function') {
|
|
17
|
+
webPackConfig = otherConfig(webPackConfig);
|
|
18
|
+
} else if (typeof otherConfig === 'object') {
|
|
19
|
+
webPackConfig = {
|
|
20
|
+
...webPackConfig,
|
|
21
|
+
...otherConfig,
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
console.warn(`Did not recognize the export from "${otherConfigPath}". Skipping.`);
|
|
25
|
+
}
|
|
26
|
+
} catch (ex) {
|
|
27
|
+
console.error(`Error while using the config from "${otherConfigPath}": ${ex}`);
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
|