-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
63 lines (58 loc) · 1.93 KB
/
webpack.common.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
const path = require("path");
const { ContextReplacementPlugin } = require("webpack");
const HTMLWebpackPlugin = require('html-webpack-plugin');
require('dotenv').config();
const { supportedLanguages } = require("./configs/derived-vars");
/**
* @type {import("webpack").Configuration}
*/
const webpackConfig = {
entry: {
index: "./src/index.js",
FMeasyBank: "./src/frontend-mentor/easybank/easybank.js",
FMcrowdFunding: "./src/frontend-mentor/crowdfunding/crowdfunding.js",
},
plugins: [
new ContextReplacementPlugin(
/date\-fns[\/\\]/,
new RegExp(`[/\\\\\](${supportedLanguages.join('|')})[/\\\\\]index\.js$`)
),
new HTMLWebpackPlugin({
filename: 'index.html',
template: "./src/frontend-mentor/frontend-mentor.pug",
chunks: ['index'],
}),
new HTMLWebpackPlugin({
filename: "404.html",
template: "./src/pages/404.pug",
chunks: ['index'],
}),
new HTMLWebpackPlugin({
filename: "frontend-mentor/index.html",
template: "./src/frontend-mentor/frontend-mentor.pug",
chunks: ['index'],
}),
new HTMLWebpackPlugin({
filename: "frontend-mentor/easybank/index.html",
template: "./src/frontend-mentor/easybank/index.pug",
chunks: ['FMeasyBank'],
}),
new HTMLWebpackPlugin({
filename: "frontend-mentor/crowdfunding/index.html",
template: "./src/frontend-mentor/crowdfunding/crowdfunding.pug",
chunks: ['FMcrowdFunding'],
}),
],
resolve: {
extensions: [".js"],
alias: {
["@wp/assets"]: path.resolve(__dirname, "src/assets"),
["@wp/components"]: path.resolve(__dirname, "src/components"),
["@wp/lib"]: path.resolve(__dirname, "src/lib"),
["@wp/pages"]: path.resolve(__dirname, "src/pages"),
["@wp/styles"]: path.resolve(__dirname, "src/styles"),
["@wp/frontend-mentor"]: path.resolve(__dirname, "src/frontend-mentor")
},
},
}
module.exports = webpackConfig;