-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
123 lines (120 loc) · 3.73 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: {
babel: 'babel-polyfill',
index: './src/js/index.js',
om: './src/js/om.js',
programs: './src/js/programs.js',
upload: './src/js/upload.js',
artikler: './src/js/artikler.js',
dashboard: './src/js/dashboard.js',
editArticle: './src/js/editArticle.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/[name].bundle.js'
},
optimization: {
splitChunks: {
chunks: 'all',
name: 'waih'
}
},
devServer: {
contentBase: './dist'
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.(s*)css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: [
'file-loader',
{
loader: 'image-webpack-loader',
options: {
disable: true, // [email protected] and newer
},
},
],
}
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/html/index.html',
chunks: ['waih', 'babel', 'index']
}),
new HtmlWebpackPlugin({
filename: 'om.html',
template: './src/html/om.html',
chunks: ['waih', 'babel', 'om']
}),
new HtmlWebpackPlugin({
filename: 'artikler.html',
template: './src/html/artikler.html',
chunks: ['waih', 'babel', 'artikler']
}),
new HtmlWebpackPlugin({
filename: 'artikel.html',
template: './src/html/artikel.html',
chunks: ['waih', 'babel', 'artikler']
}),
new HtmlWebpackPlugin({
filename: 'programs.html',
template: './src/html/programs.html',
chunks: ['waih', 'babel', 'programs']
}),
new HtmlWebpackPlugin({
filename: 'program.html',
template: './src/html/program.html',
chunks: ['waih', 'babel', 'programs']
}),
new HtmlWebpackPlugin({
filename: 'uploadPodcast.html',
template: './src/html/uploadPodcast.html',
chunks: ['waih', 'babel', 'upload']
}),
new HtmlWebpackPlugin({
filename: 'uploadArtikel.html',
template: './src/html/uploadArtikel.html',
chunks: ['waih', 'babel', 'upload']
}),
new HtmlWebpackPlugin({
filename: 'dashboard.html',
template: './src/html/dashboard.html',
chunks: ['waih', 'babel', 'dashboard']
}),
new HtmlWebpackPlugin({
filename: 'editArticle.html',
template: './src/html/editArticle.html',
chunks: ['waih', 'babel', 'editArticle']
}),
new HtmlWebpackPlugin({
filename: 'login.html',
template: './src/html/login.html',
chunks: ['waih', 'babel']
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
}),
new MiniCssExtractPlugin({
filename: "[name].sass",
chunkFilename: "[id].sass"
}),
],
};
// console.log(filename);