@epilot360/webpack-config-epilot360 2.4.2 → 2.4.3
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
2
|
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
3
4
|
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
|
4
|
-
const
|
|
5
|
+
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
5
6
|
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
|
6
7
|
const StandaloneSingleSpaPlugin = require("standalone-single-spa-webpack-plugin");
|
|
7
8
|
const SystemJSPublicPathPlugin = require("systemjs-webpack-interop/SystemJSPublicPathWebpackPlugin");
|
|
@@ -14,39 +15,39 @@ module.exports = webpackConfigEpilot360ReactApp;
|
|
|
14
15
|
|
|
15
16
|
function webpackConfigEpilot360ReactApp(opts) {
|
|
16
17
|
if (typeof opts !== "object") {
|
|
17
|
-
throw Error(`webpack-config-epilot360
|
|
18
|
+
throw Error(`webpack-config-epilot360 requires an opts object`);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
if (typeof opts.orgName !== "string") {
|
|
21
22
|
throw Error(
|
|
22
|
-
`webpack-config-epilot360
|
|
23
|
+
`webpack-config-epilot360 requires an opts.orgName string`
|
|
23
24
|
);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
if (typeof opts.projectName !== "string") {
|
|
27
28
|
throw Error(
|
|
28
|
-
`webpack-config-epilot360
|
|
29
|
+
`webpack-config-epilot360 requires an opts.projectName string`
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let webpackConfigEnv = opts.webpackConfigEnv || {};
|
|
37
|
-
|
|
38
|
-
let argv = opts.argv || {};
|
|
39
|
-
|
|
40
|
-
let isProduction = argv.p || argv.mode === "production";
|
|
33
|
+
const webpackConfigEnv = opts.webpackConfigEnv || {};
|
|
34
|
+
const argv = opts.argv || {};
|
|
35
|
+
const isProduction = argv.p || argv.mode === "production";
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
const indexEntrypoint = path.resolve(
|
|
38
|
+
process.cwd(),
|
|
39
|
+
'src',
|
|
40
|
+
'index.ts',
|
|
41
|
+
)
|
|
42
|
+
const legacyEntrypoint = path.resolve(
|
|
43
|
+
process.cwd(),
|
|
44
|
+
'src',
|
|
45
|
+
`${opts.orgName}-${opts.projectName}.tsx`
|
|
46
|
+
)
|
|
43
47
|
|
|
44
48
|
return {
|
|
45
49
|
mode: isProduction ? "production" : "development",
|
|
46
|
-
entry:
|
|
47
|
-
process.cwd(),
|
|
48
|
-
`src/${opts.orgName}-${opts.projectName}.tsx`
|
|
49
|
-
),
|
|
50
|
+
entry: fs.fileExistsSync(indexEntrypoint) ? indexEntrypoint : legacyEntrypoint,
|
|
50
51
|
output: {
|
|
51
52
|
filename: `bundle.js`,
|
|
52
53
|
libraryTarget: "system",
|
package/package.json
CHANGED