-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
91 lines (90 loc) · 3.23 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
const webpack = require('webpack');
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
module.exports = {
watch: false,
watchOptions: {
ignored: ['**/node_modules'],
},
entry: {
posts: [path.resolve(__dirname, 'Modules/Posts/assets/skin-carousel.js')],
'maps-conditions-admin': [path.resolve(__dirname, 'Lib/Conditions/assets/admin.js')],
'maps-conditions-public': [path.resolve(__dirname, 'Lib/Conditions/assets/public.js')],
'maps-documents': [path.resolve(__dirname, 'Modules/Documents/assets/skin-default.js')],
'maps-documents-links': [path.resolve(__dirname, 'Modules/Document_Links/assets/skin-default.js')],
'maps-cta-accordion': [
path.resolve(__dirname, 'Modules/CTA_Accordion/assets/skin-default.js'),
path.resolve(__dirname, 'Modules/CTA_Accordion/assets/skin-horizontal.js'),
],
'maps-carousel': [path.resolve(__dirname, 'Modules/Carousel/assets/skin-default.js')],
'maps-slider-tabs': [path.resolve(__dirname, 'Modules/Slider_Tabs/assets/skin-default.js')],
'maps-taxonomy': [path.resolve(__dirname, 'Modules/Taxonomy/assets/skin-default.js')],
'maps-teams': [path.resolve(__dirname, 'Modules/Teams/assets/skin-default.js')],
'maps-menu-full-screen': [path.resolve(__dirname, 'Modules/Menu_Full_Screen/assets/skin-default.js')],
'maps-menu-multi-level': [path.resolve(__dirname, 'Modules/Menu_Multi_Level/assets/skin-default.js')],
'maps-nav-menu': [path.resolve(__dirname, 'Modules/Nav_Menu/assets/skin-default.js')],
'maps-toggle-timeline': [path.resolve(__dirname, 'Modules/Toggle_Timeline/assets/skin-default.js')],
'maps-toggle-text': [path.resolve(__dirname, 'Modules/Toggle_Text/assets/skin-default.js')],
'maps-reorder': [path.resolve(__dirname, 'Lib/Reorder/assets/reorder.js')],
},
output: {
path: path.resolve(__dirname, 'assets'),
filename: 'js/[name].bundle.min.js',
},
externals: {
jquery: 'jQuery',
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['**/*', '!img', '!img/**/*'],
}),
new MiniCssExtractPlugin({
filename: 'css/[name].bundle.min.css',
}),
new CompressionPlugin({
test: /\.(js|css)$/,
}),
new ESLintPlugin({
files: 'Modules/**/*.{js,jsx}',
extensions: ['js', 'jsx'],
}),
],
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader'],
exclude: [/node_modules/],
},
{
test: /\.css$/i,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false,
},
},
],
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
},
},
},
minimizer: [new CssMinimizerPlugin(), new TerserPlugin()],
},
};