-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (42 loc) · 1.06 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
const path = require("path");
const glob = require('glob')
const PATHS = {
src: path.join(__dirname, 'src')
}
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const PurgecssPlugin = require("purgecss-webpack-plugin");
module.exports = {
mode: "production",
entry: {
libs: "./src/assets/js/libs.js", //specifying bundle with js libraries
main: "./src/assets/js/main.js", //specifying bundle with custom js files
"styles-libs": "./src/assets/js/styles-libs.js", //specifying bundle with css libraries
},
plugins: [
new MiniCssExtractPlugin(),
new PurgecssPlugin({
paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
],
},
output: {
filename: "[name].js",
},
};