@epilot360/webpack-config-epilot360 2.4.0 → 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 _HtmlWebpackPlugin = require("html-webpack-plugin");
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-react requires an opts object`);
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-react requires an opts.orgName string`
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-react requires an opts.projectName string`
29
+ `webpack-config-epilot360 requires an opts.projectName string`
29
30
  );
30
31
  }
31
32
 
32
- if (opts.orgPackagesAsExternal !== false) {
33
- opts.orgPackagesAsExternal = true;
34
- }
35
-
36
- let webpackConfigEnv = opts.webpackConfigEnv || {};
37
-
38
- let argv = opts.argv || {};
33
+ const webpackConfigEnv = opts.webpackConfigEnv || {};
34
+ const argv = opts.argv || {};
35
+ const isProduction = argv.p || argv.mode === "production";
39
36
 
40
- let isProduction = argv.p || argv.mode === "production";
41
-
42
- let HtmlWebpackPlugin = opts.HtmlWebpackPlugin || _HtmlWebpackPlugin;
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: path.resolve(
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",
@@ -54,7 +55,7 @@ function webpackConfigEpilot360ReactApp(opts) {
54
55
  uniqueName: opts.projectName,
55
56
  devtoolNamespace: `${opts.projectName}`,
56
57
  publicPath: "",
57
- chunkFilename: "[name].[contenthash].js",
58
+ chunkFilename: 'chunk-[name].[chunkhash].js',
58
59
  },
59
60
  module: {
60
61
  rules: [
@@ -83,6 +84,9 @@ function webpackConfigEpilot360ReactApp(opts) {
83
84
  modules: false,
84
85
  },
85
86
  },
87
+ {
88
+ loader: require.resolve("postcss-loader", { paths: [__dirname] }),
89
+ },
86
90
  {
87
91
  loader: require.resolve('esbuild-loader', { paths: [__dirname] }),
88
92
  options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot360/webpack-config-epilot360",
3
- "version": "2.4.0",
3
+ "version": "2.4.3",
4
4
  "description": "A webpack config for in-browser modules used with single-spa for Epilot360",
5
5
  "main": "lib/webpack-config-epilot360-portal.js",
6
6
  "directories": {
@@ -17,6 +17,8 @@
17
17
  "fork-ts-checker-webpack-plugin": "^6.0.5",
18
18
  "html-webpack-plugin": "^5.1.0",
19
19
  "https-browserify": "^1.0.0",
20
+ "postcss": "^8.4.12",
21
+ "postcss-loader": "^6.2.1",
20
22
  "standalone-single-spa-webpack-plugin": "^1.1.0",
21
23
  "style-loader": "^2.0.0",
22
24
  "systemjs-webpack-interop": "^2.3.2",