-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
51 lines (43 loc) · 1.22 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
/* eslint-disable */
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const JS_DIR = path.resolve(__dirname, './src');
const JS_ASSET = path.resolve(__dirname, './assets');
const entry = {
theme: './src/templates/index.js',
product: './src/templates/product.js',
collection: './src/templates/collection.js',
password: './src/templates/password.js',
customer: './src/templates/customer.js',
contact: './src/templates/contact.js',
critical: './src/templates/critical.js',
breadcrumbs: './assets/breadcrumbs.module.js',
pagination: './assets/pagination.module.js',
faq: './assets/faq-section.module.js',
productcard: './assets/component-card-product.module.js',
cart: './src/templates/cart.js'
}
const output = {
filename: '[name].js',
path: path.resolve(__dirname, 'assets'),
};
const rules = [
{
test: /\.js$/,
include: [JS_DIR, JS_ASSET],
exclude: /node_modules/,
use: 'babel-loader',
},
];
module.exports = {
entry: entry,
output: output,
module: {
rules: rules,
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
},
};