afront 1.0.22 → 1.0.25
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/.babelrc +13 -13
- package/.env +1 -1
- package/LICENSE +21 -21
- package/README.md +94 -94
- package/build-prod/index.html +1 -1
- package/build-prod/manifest.json +25 -25
- package/build-prod/offline.html +1023 -1023
- package/build-prod/robots.txt +3 -3
- package/build-prod-static/index.html +1 -1
- package/build-prod-static/manifest.json +25 -25
- package/build-prod-static/offline.html +1023 -1023
- package/build-prod-static/robots.txt +3 -3
- package/install.js +415 -415
- package/package.json +102 -95
- package/server.js +40 -40
- package/src/ARoutes/AFRoutes.js +28 -28
- package/src/Api/api.config.js +266 -266
- package/src/Api/login.service.js +44 -44
- package/src/App.js +28 -28
- package/src/Components/Background/MeshGradient.js +18 -18
- package/src/Components/Footer/Footer.js +108 -108
- package/src/Components/Header/Header.js +149 -149
- package/src/Components/Loading/LoadingIndicator.js +12 -12
- package/src/Components/Loading/LoadingIndicator.module.css +34 -34
- package/src/Components/Loading/LoadingSpinner.js +27 -27
- package/src/Components/Loading/LoadingSpinner.module.css +100 -100
- package/src/Components/RequireAuth.js +29 -29
- package/src/LoadingFallback.js +13 -13
- package/src/PageNotFound.js +19 -19
- package/src/Pages/Home.js +50 -50
- package/src/Pages/Signup.js +230 -230
- package/src/Pages/Support.js +68 -68
- package/src/Routes/ARoutes.js +66 -66
- package/src/Routes/ARoutesStatic.js +83 -83
- package/src/Static/appStatic.js +16 -16
- package/src/Static/indexStatic.js +13 -13
- package/src/Style/App.module.css +11 -11
- package/src/Style/MeshGradient.module.css +130 -130
- package/src/Style/PageNotFound.module.css +37 -37
- package/src/Style/Style.module.css +686 -686
- package/src/Style/Support.module.css +185 -185
- package/src/Utils/LoadingContext.js +5 -5
- package/src/index.js +25 -25
- package/webpack.build-prod.js +141 -140
- package/webpack.dev.js +127 -127
- package/webpack.prod.js +148 -147
- package/webpack.ssr.prod.js +97 -97
package/webpack.build-prod.js
CHANGED
|
@@ -1,141 +1,142 @@
|
|
|
1
|
-
const htmlWebpackPlugin = require("html-webpack-plugin");
|
|
2
|
-
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
|
|
3
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
4
|
-
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
5
|
-
const TerserWebpackPlugin = require("terser-webpack-plugin");
|
|
6
|
-
|
|
7
|
-
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
const crypto = require("crypto");
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
mode: "production",
|
|
13
|
-
entry: "./src/Static/indexStatic.js",
|
|
14
|
-
output: {
|
|
15
|
-
filename: "static/js/[name]-[contenthash].js",
|
|
16
|
-
path: path.resolve(__dirname, "build-prod-static"),
|
|
17
|
-
publicPath: "/",
|
|
18
|
-
clean: true,
|
|
19
|
-
},
|
|
20
|
-
module: {
|
|
21
|
-
rules: [
|
|
22
|
-
{
|
|
23
|
-
test: /\.js$/,
|
|
24
|
-
exclude: /node_modules/,
|
|
25
|
-
use: [
|
|
26
|
-
{
|
|
27
|
-
loader: "babel-loader",
|
|
28
|
-
options: {
|
|
29
|
-
configFile: path.resolve(__dirname, "./.babelrc"),
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
test: /\.css$/,
|
|
36
|
-
use: [
|
|
37
|
-
MiniCssExtractPlugin.loader,
|
|
38
|
-
{
|
|
39
|
-
loader: "css-loader",
|
|
40
|
-
options: {
|
|
41
|
-
modules: {
|
|
42
|
-
localIdentName: "asggen-[hash:base64:7]",
|
|
43
|
-
},
|
|
44
|
-
sourceMap: true,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
test: /\.(png|jpe?g|gif|svg)$/,
|
|
51
|
-
type: "asset/resource",
|
|
52
|
-
generator: {
|
|
53
|
-
filename: "static/media/[contenthash][ext]",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/,
|
|
58
|
-
type: "asset/resource",
|
|
59
|
-
generator: {
|
|
60
|
-
filename: "static/media/[name][ext]",
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
|
65
|
-
type: "asset/resource",
|
|
66
|
-
generator: {
|
|
67
|
-
filename: "static/fonts/[name][ext]",
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
optimization: {
|
|
73
|
-
minimizer: [
|
|
74
|
-
new TerserWebpackPlugin({
|
|
75
|
-
terserOptions: {
|
|
76
|
-
compress: {
|
|
77
|
-
drop_console: false,
|
|
78
|
-
},
|
|
79
|
-
format: {
|
|
80
|
-
comments: false, // Remove all comments
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
extractComments: false, // Do not extract comments to a separate file
|
|
84
|
-
}),
|
|
85
|
-
new CssMinimizerPlugin(),
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
plugins: [
|
|
89
|
-
new htmlWebpackPlugin({
|
|
90
|
-
title: "AFront",
|
|
91
|
-
template: "./dev/index.html",
|
|
92
|
-
buildTag: `prod-[contenthash]`,
|
|
93
|
-
hash: true,
|
|
94
|
-
minify: {
|
|
95
|
-
removeComments: true,
|
|
96
|
-
collapseWhitespace: true,
|
|
97
|
-
minifyCSS: true,
|
|
98
|
-
minifyJS: true,
|
|
99
|
-
},
|
|
100
|
-
templateParameters: (compilation, options) => {
|
|
101
|
-
const hash = crypto.createHash("sha256");
|
|
102
|
-
hash.update(compilation.hash);
|
|
103
|
-
const sha256Hash = hash.digest("hex");
|
|
104
|
-
return {
|
|
105
|
-
htmlWebpackPlugin: {
|
|
106
|
-
options: {
|
|
107
|
-
title: "AFront",
|
|
108
|
-
buildTag: `prod-${sha256Hash}`,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
}),
|
|
114
|
-
new CspHtmlWebpackPlugin({
|
|
115
|
-
"default-src": ["'self'"],
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"style-src
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
{ from: "dev/
|
|
131
|
-
{ from: "dev/
|
|
132
|
-
{ from: "dev/
|
|
133
|
-
{ from: "dev/
|
|
134
|
-
{ from: "dev/
|
|
135
|
-
{ from: "dev/
|
|
136
|
-
{ from: "dev/
|
|
137
|
-
{ from: "dev/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
1
|
+
const htmlWebpackPlugin = require("html-webpack-plugin");
|
|
2
|
+
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
|
|
3
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
4
|
+
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
5
|
+
const TerserWebpackPlugin = require("terser-webpack-plugin");
|
|
6
|
+
|
|
7
|
+
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const crypto = require("crypto");
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
mode: "production",
|
|
13
|
+
entry: "./src/Static/indexStatic.js",
|
|
14
|
+
output: {
|
|
15
|
+
filename: "static/js/[name]-[contenthash].js",
|
|
16
|
+
path: path.resolve(__dirname, "build-prod-static"),
|
|
17
|
+
publicPath: "/",
|
|
18
|
+
clean: true,
|
|
19
|
+
},
|
|
20
|
+
module: {
|
|
21
|
+
rules: [
|
|
22
|
+
{
|
|
23
|
+
test: /\.js$/,
|
|
24
|
+
exclude: /node_modules/,
|
|
25
|
+
use: [
|
|
26
|
+
{
|
|
27
|
+
loader: "babel-loader",
|
|
28
|
+
options: {
|
|
29
|
+
configFile: path.resolve(__dirname, "./.babelrc"),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
test: /\.css$/,
|
|
36
|
+
use: [
|
|
37
|
+
MiniCssExtractPlugin.loader,
|
|
38
|
+
{
|
|
39
|
+
loader: "css-loader",
|
|
40
|
+
options: {
|
|
41
|
+
modules: {
|
|
42
|
+
localIdentName: "asggen-[hash:base64:7]",
|
|
43
|
+
},
|
|
44
|
+
sourceMap: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
test: /\.(png|jpe?g|gif|svg)$/,
|
|
51
|
+
type: "asset/resource",
|
|
52
|
+
generator: {
|
|
53
|
+
filename: "static/media/[contenthash][ext]",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/,
|
|
58
|
+
type: "asset/resource",
|
|
59
|
+
generator: {
|
|
60
|
+
filename: "static/media/[name][ext]",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
|
65
|
+
type: "asset/resource",
|
|
66
|
+
generator: {
|
|
67
|
+
filename: "static/fonts/[name][ext]",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
optimization: {
|
|
73
|
+
minimizer: [
|
|
74
|
+
new TerserWebpackPlugin({
|
|
75
|
+
terserOptions: {
|
|
76
|
+
compress: {
|
|
77
|
+
drop_console: false,
|
|
78
|
+
},
|
|
79
|
+
format: {
|
|
80
|
+
comments: false, // Remove all comments
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
extractComments: false, // Do not extract comments to a separate file
|
|
84
|
+
}),
|
|
85
|
+
new CssMinimizerPlugin(),
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
plugins: [
|
|
89
|
+
new htmlWebpackPlugin({
|
|
90
|
+
title: "AFront",
|
|
91
|
+
template: "./dev/index.html",
|
|
92
|
+
buildTag: `prod-[contenthash]`,
|
|
93
|
+
hash: true,
|
|
94
|
+
minify: {
|
|
95
|
+
removeComments: true,
|
|
96
|
+
collapseWhitespace: true,
|
|
97
|
+
minifyCSS: true,
|
|
98
|
+
minifyJS: true,
|
|
99
|
+
},
|
|
100
|
+
templateParameters: (compilation, options) => {
|
|
101
|
+
const hash = crypto.createHash("sha256");
|
|
102
|
+
hash.update(compilation.hash);
|
|
103
|
+
const sha256Hash = hash.digest("hex");
|
|
104
|
+
return {
|
|
105
|
+
htmlWebpackPlugin: {
|
|
106
|
+
options: {
|
|
107
|
+
title: "AFront",
|
|
108
|
+
buildTag: `prod-${sha256Hash}`,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
new CspHtmlWebpackPlugin({
|
|
115
|
+
"default-src": ["'self'"],
|
|
116
|
+
"connect-src": ["'self'", "wss:"],
|
|
117
|
+
"script-src": ["'self'"],
|
|
118
|
+
"style-src": ["'self'", "https://fonts.googleapis.com", "'unsafe-hashes'"],
|
|
119
|
+
"style-src-elem": ["'self'", "https://fonts.googleapis.com", "https://fonts.gstatic.com"],
|
|
120
|
+
"font-src": ["'self'", "https://fonts.gstatic.com"]
|
|
121
|
+
}, {
|
|
122
|
+
hashingMethod: 'sha256',
|
|
123
|
+
hashEnabled: { 'script-src': true, 'style-src': true }
|
|
124
|
+
}),
|
|
125
|
+
new MiniCssExtractPlugin({
|
|
126
|
+
filename: "static/css/[name]-[contenthash].css",
|
|
127
|
+
}),
|
|
128
|
+
new CopyWebpackPlugin({
|
|
129
|
+
patterns: [
|
|
130
|
+
{ from: "dev/favicon.ico", to: "favicon.ico" }, // Copy favicon
|
|
131
|
+
{ from: "dev/logo192.png", to: "logo192.png" }, // Copy logo192
|
|
132
|
+
{ from: "dev/logo512.png", to: "logo512.png" }, // Copy logo512
|
|
133
|
+
{ from: "dev/manifest.json", to: "manifest.json" }, // Copy manifest
|
|
134
|
+
{ from: "dev/style.css", to: "style.css" },
|
|
135
|
+
{ from: "dev/inline.js", to: "inline.js" },
|
|
136
|
+
{ from: "dev/robots.txt", to: "robots.txt" },
|
|
137
|
+
{ from: "dev/service-worker.js", to: "service-worker.js" },
|
|
138
|
+
{ from: "dev/offline.html", to: "offline.html" },
|
|
139
|
+
],
|
|
140
|
+
}),
|
|
141
|
+
],
|
|
141
142
|
};
|
package/webpack.dev.js
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
const htmlWebpackPlugin = require("html-webpack-plugin");
|
|
2
|
-
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
5
|
-
const TerserWebpackPlugin = require("terser-webpack-plugin");
|
|
6
|
-
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
7
|
-
const crypto = require("crypto");
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
mode: "development",
|
|
11
|
-
entry: "./src/index.js",
|
|
12
|
-
devtool: "cheap-module-source-map",
|
|
13
|
-
devServer: {
|
|
14
|
-
static: {
|
|
15
|
-
directory: path.join(__dirname, "dev"),
|
|
16
|
-
},
|
|
17
|
-
port: 9999,
|
|
18
|
-
open: true,
|
|
19
|
-
historyApiFallback: true,
|
|
20
|
-
headers: {
|
|
21
|
-
// Dev server: send a permissive CSP header to avoid blocking during development.
|
|
22
|
-
// This header is intentionally more permissive than the production meta tag.
|
|
23
|
-
"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
output: {
|
|
27
|
-
filename: "[name].bundle.js",
|
|
28
|
-
path: `${__dirname}/dev`,
|
|
29
|
-
publicPath: "/",
|
|
30
|
-
clean: true,
|
|
31
|
-
},
|
|
32
|
-
module: {
|
|
33
|
-
rules: [
|
|
34
|
-
{
|
|
35
|
-
test: /\.js$/,
|
|
36
|
-
exclude: /node_modules/,
|
|
37
|
-
use: [
|
|
38
|
-
{
|
|
39
|
-
loader: "babel-loader",
|
|
40
|
-
options: {
|
|
41
|
-
configFile: path.resolve(__dirname, "./.babelrc"),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
test: /\.module\.css$/,
|
|
48
|
-
use: [
|
|
49
|
-
MiniCssExtractPlugin.loader,
|
|
50
|
-
{
|
|
51
|
-
loader: "css-loader",
|
|
52
|
-
options: {
|
|
53
|
-
modules: {
|
|
54
|
-
localIdentName: "[local]",
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
test: /\.css$/,
|
|
62
|
-
exclude: /\.module\.css$/,
|
|
63
|
-
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
test: /\.(png|jpe?g|gif|svg)$/,
|
|
67
|
-
type: "asset/resource",
|
|
68
|
-
generator: {
|
|
69
|
-
filename: "static/media/[name][ext]",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/,
|
|
74
|
-
type: "asset/resource",
|
|
75
|
-
generator: {
|
|
76
|
-
filename: "static/media/[name][ext]",
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
|
81
|
-
type: "asset/resource",
|
|
82
|
-
generator: {
|
|
83
|
-
filename: "static/fonts/[name][ext]",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
optimization: {
|
|
89
|
-
minimizer: [new TerserWebpackPlugin(), new CssMinimizerPlugin()],
|
|
90
|
-
},
|
|
91
|
-
resolve: {
|
|
92
|
-
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
93
|
-
},
|
|
94
|
-
plugins: [
|
|
95
|
-
new MiniCssExtractPlugin({
|
|
96
|
-
filename: "static/css/[name].bundle.css",
|
|
97
|
-
}),
|
|
98
|
-
new htmlWebpackPlugin({
|
|
99
|
-
title: "AFront",
|
|
100
|
-
template: `${__dirname}/dev/index.html`,
|
|
101
|
-
filename: "index.html",
|
|
102
|
-
hash: true, // This will add the hash in the injected scripts
|
|
103
|
-
templateParameters: (compilation) => {
|
|
104
|
-
const hash = crypto.createHash("sha256");
|
|
105
|
-
hash.update(compilation.hash);
|
|
106
|
-
const sha256Hash = hash.digest("hex");
|
|
107
|
-
return {
|
|
108
|
-
htmlWebpackPlugin: {
|
|
109
|
-
options: {
|
|
110
|
-
title: "AFront",
|
|
111
|
-
buildTag: `dev-${sha256Hash}`, // Set the build tag with the hash for dev
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
}),
|
|
117
|
-
new CspHtmlWebpackPlugin({
|
|
118
|
-
"default-src": ["'self'"],
|
|
119
|
-
"script-src": ["'self'"],
|
|
120
|
-
"style-src": ["'self'", "https://fonts.googleapis.com", "'unsafe-hashes'"],
|
|
121
|
-
"style-src-elem": ["'self'", "https://fonts.googleapis.com", "https://fonts.gstatic.com"],
|
|
122
|
-
"font-src": ["'self'", "https://fonts.gstatic.com"]
|
|
123
|
-
}, {
|
|
124
|
-
hashingMethod: 'sha256',
|
|
125
|
-
hashEnabled: { 'script-src': true, 'style-src': true }
|
|
126
|
-
}),
|
|
127
|
-
],
|
|
1
|
+
const htmlWebpackPlugin = require("html-webpack-plugin");
|
|
2
|
+
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
5
|
+
const TerserWebpackPlugin = require("terser-webpack-plugin");
|
|
6
|
+
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
7
|
+
const crypto = require("crypto");
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
mode: "development",
|
|
11
|
+
entry: "./src/index.js",
|
|
12
|
+
devtool: "cheap-module-source-map",
|
|
13
|
+
devServer: {
|
|
14
|
+
static: {
|
|
15
|
+
directory: path.join(__dirname, "dev"),
|
|
16
|
+
},
|
|
17
|
+
port: 9999,
|
|
18
|
+
open: true,
|
|
19
|
+
historyApiFallback: true,
|
|
20
|
+
headers: {
|
|
21
|
+
// Dev server: send a permissive CSP header to avoid blocking during development.
|
|
22
|
+
// This header is intentionally more permissive than the production meta tag.
|
|
23
|
+
"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
output: {
|
|
27
|
+
filename: "[name].bundle.js",
|
|
28
|
+
path: `${__dirname}/dev`,
|
|
29
|
+
publicPath: "/",
|
|
30
|
+
clean: true,
|
|
31
|
+
},
|
|
32
|
+
module: {
|
|
33
|
+
rules: [
|
|
34
|
+
{
|
|
35
|
+
test: /\.js$/,
|
|
36
|
+
exclude: /node_modules/,
|
|
37
|
+
use: [
|
|
38
|
+
{
|
|
39
|
+
loader: "babel-loader",
|
|
40
|
+
options: {
|
|
41
|
+
configFile: path.resolve(__dirname, "./.babelrc"),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
test: /\.module\.css$/,
|
|
48
|
+
use: [
|
|
49
|
+
MiniCssExtractPlugin.loader,
|
|
50
|
+
{
|
|
51
|
+
loader: "css-loader",
|
|
52
|
+
options: {
|
|
53
|
+
modules: {
|
|
54
|
+
localIdentName: "[local]",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
test: /\.css$/,
|
|
62
|
+
exclude: /\.module\.css$/,
|
|
63
|
+
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
test: /\.(png|jpe?g|gif|svg)$/,
|
|
67
|
+
type: "asset/resource",
|
|
68
|
+
generator: {
|
|
69
|
+
filename: "static/media/[name][ext]",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/,
|
|
74
|
+
type: "asset/resource",
|
|
75
|
+
generator: {
|
|
76
|
+
filename: "static/media/[name][ext]",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/,
|
|
81
|
+
type: "asset/resource",
|
|
82
|
+
generator: {
|
|
83
|
+
filename: "static/fonts/[name][ext]",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
optimization: {
|
|
89
|
+
minimizer: [new TerserWebpackPlugin(), new CssMinimizerPlugin()],
|
|
90
|
+
},
|
|
91
|
+
resolve: {
|
|
92
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
93
|
+
},
|
|
94
|
+
plugins: [
|
|
95
|
+
new MiniCssExtractPlugin({
|
|
96
|
+
filename: "static/css/[name].bundle.css",
|
|
97
|
+
}),
|
|
98
|
+
new htmlWebpackPlugin({
|
|
99
|
+
title: "AFront",
|
|
100
|
+
template: `${__dirname}/dev/index.html`,
|
|
101
|
+
filename: "index.html",
|
|
102
|
+
hash: true, // This will add the hash in the injected scripts
|
|
103
|
+
templateParameters: (compilation) => {
|
|
104
|
+
const hash = crypto.createHash("sha256");
|
|
105
|
+
hash.update(compilation.hash);
|
|
106
|
+
const sha256Hash = hash.digest("hex");
|
|
107
|
+
return {
|
|
108
|
+
htmlWebpackPlugin: {
|
|
109
|
+
options: {
|
|
110
|
+
title: "AFront",
|
|
111
|
+
buildTag: `dev-${sha256Hash}`, // Set the build tag with the hash for dev
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
new CspHtmlWebpackPlugin({
|
|
118
|
+
"default-src": ["'self'"],
|
|
119
|
+
"script-src": ["'self'"],
|
|
120
|
+
"style-src": ["'self'", "https://fonts.googleapis.com", "'unsafe-hashes'"],
|
|
121
|
+
"style-src-elem": ["'self'", "https://fonts.googleapis.com", "https://fonts.gstatic.com"],
|
|
122
|
+
"font-src": ["'self'", "https://fonts.gstatic.com"]
|
|
123
|
+
}, {
|
|
124
|
+
hashingMethod: 'sha256',
|
|
125
|
+
hashEnabled: { 'script-src': true, 'style-src': true }
|
|
126
|
+
}),
|
|
127
|
+
],
|
|
128
128
|
};
|