-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
106 lines (103 loc) · 4.72 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const path = require("path");
const { merge } = require("webpack-merge");
const singleSpaDefaults = require("webpack-config-single-spa-react-ts");
const webpack = require("webpack");
const dotenv = require("dotenv").config();
const { ImportMapWebpackPlugin } = require("@hackney/webpack-import-map-plugin");
module.exports = (webpackConfigEnv, argv) => {
const defaultConfig = singleSpaDefaults({
orgName: "mtfh",
projectName: "common",
webpackConfigEnv,
argv,
});
const apiPath = path.join(__dirname, "lib", "api");
return merge(defaultConfig, {
entry: {
common: path.join(__dirname, "lib", "mtfh-common.tsx"),
"common/lib/auth": path.join(__dirname, "lib", "auth"),
"common/lib/http": path.join(__dirname, "lib", "http"),
"common/lib/config": path.join(__dirname, "lib", "config"),
"common/lib/configuration": path.join(__dirname, "lib", "configuration"),
"common/lib/components": path.join(__dirname, "lib", "components"),
"common/lib/hooks": path.join(__dirname, "lib", "hooks"),
"common/lib/utils": path.join(__dirname, "lib", "utils"),
"common/lib/context": path.join(__dirname, "lib", "context"),
"common/lib/api/person/v1": path.join(apiPath, "person", "v1"),
"common/lib/api/person/v2": path.join(apiPath, "person", "v2"),
"common/lib/api/contact-details/v1": path.join(apiPath, "contact-details", "v1"),
"common/lib/api/contact-details/v2": path.join(apiPath, "contact-details", "v2"),
"common/lib/api/cautionary-alerts/v1": path.join(
apiPath,
"cautionary-alerts",
"v1",
),
"common/lib/api/tenure/v1": path.join(apiPath, "tenure", "v1"),
"common/lib/api/comments/v1": path.join(apiPath, "comments", "v1"),
"common/lib/api/comments/v2": path.join(apiPath, "comments", "v2"),
"common/lib/api/asset/v1": path.join(apiPath, "asset", "v1"),
"common/lib/api/reference-data/v1": path.join(apiPath, "reference-data", "v1"),
"common/lib/api/address/v1": path.join(apiPath, "address", "v1"),
"common/lib/api/process/v1": path.join(apiPath, "process", "v1"),
"common/lib/api/process/v2": path.join(apiPath, "process", "v2"),
"common/lib/api/patch/v1": path.join(apiPath, "patch", "v1"),
"common/lib/api/housing-finance-interim-api": path.join(apiPath, "housing-finance-interim-api"),
"common/lib/api/equality-information/v1": path.join(
apiPath,
"equality-information",
"v1",
),
},
output: {
filename: "[name].[contenthash].js",
},
resolve: {
alias: {
"@mtfh/common/lib": path.join(__dirname, "lib"),
},
},
module: {
rules: [
{
test: /\.scss$/i,
use: ["style-loader", "css-loader", "sass-loader"],
},
],
},
externals: ["react", "react-dom", "react-router-dom", "formik", "date-fns"],
plugins: [
new webpack.EnvironmentPlugin({
APP_ENV: process.env.APP_ENV || "test",
AUTH_ALLOWED_GROUPS: dotenv.AUTH_ALLOWED_GROUPS || "",
AUTH_DOMAIN: dotenv.AUTHDOMAIN || "",
COOKIE_DOMAIN: dotenv.COOKIE_DOMAIN || "",
AUTH_TOKEN_NAME: dotenv.AUTH_TOKEN_NAME || "",
CONFIGURATION_API_URL_V1: dotenv.CONFIGURATION_API_URL_V1 || "",
CONTACT_DETAILS_API_URL_V1: dotenv.CONTACT_DETAILS_API_URL_V1 || "",
CONTACT_DETAILS_API_URL_V2: dotenv.CONTACT_DETAILS_API_URL_V2 || "",
CAUTIONARY_API_URL_V1: dotenv.CAUTIONARY_API_URL_V1 || "",
PERSON_API_URL_V1: dotenv.PERSON_API_URL_V1 || "",
PERSON_API_URL_V2: dotenv.PERSON_API_URL_V2 || "",
NOTES_API_URL_V1: dotenv.NOTES_API_URL_V1 || "",
NOTES_API_URL_V2: dotenv.NOTES_API_URL_V2 || "",
TENURE_API_URL_V1: dotenv.TENURE_API_URL_V1 || "",
PROPERTY_API_URL_V1: dotenv.PROPERTY_API_URL_V1 || "",
REFERENCE_DATA_API_URL_V1: dotenv.REFERENCE_DATA_API_URL_V1 || "",
ADDRESS_API_URL_V1: dotenv.ADDRESS_API_URL_V1 || "",
ADDRESS_API_URL_V2: dotenv.ADDRESS_API_URL_V2 || "",
EQUALITY_INFORMATION_API_URL_V1: dotenv.EQUALITY_INFORMATION_API_URL_V1 || "",
HOUSING_FINANCE_INTERIM_API_URL_V1: dotenv.HOUSING_FINANCE_INTERIM_API_URL_V1 || "",
REPAIRS_HUB_APP_URL: dotenv.REPAIRS_HUB_APP_URL || "",
REPAIRS_HUB_API_URL: dotenv.REPAIRS_HUB_API_URL || "",
PROCESS_API_URL_V1: dotenv.PROCESS_API_URL_V1 || "",
PROCESS_API_URL_V2: dotenv.PROCESS_API_URL_V2 || "",
HOUSINGSEARCH_API_URL_V1: dotenv.HOUSINGSEARCH_API_URL_V1 || "",
PATCHES_AND_AREAS_API_V1: dotenv.PATCHES_AND_AREAS_API_V1 || ""
}),
new ImportMapWebpackPlugin({
namespace: "@mtfh",
basePath: process.env.APP_CDN || "http://localhost:8040",
}),
],
});
};