forked from ADE-Scheduler/ADE-Scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
107 lines (102 loc) · 2.32 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
/* global module */
/* global __dirname */
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const pages = [
// Security pages are no longer required; we keep them just in case...
// 'security/change_password',
// 'security/forgot_password',
// 'security/login_user',
// 'security/register_user',
// 'security/reset_password',
// 'security/send_confirmation',
'errorhandler/403',
'errorhandler/404',
'errorhandler/500',
'account',
'calendar',
'classroom',
'help',
'contact',
'whatisnew',
'contribute',
'admin',
];
const conf = {
mode: 'development',
entry: {},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
module: {
rules: [
{
test: /\.(png|jpe?g|gif|svg)$/,
use: [{
loader: 'file-loader',
options: {
name: '[contenthash].[ext]',
outputPath: 'img',
esModule: false
}
}]
},
{
test: /\.(sa|sc|c)ss$/,
use: ['vue-style-loader', 'style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}
]
}
]
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
inject: false,
minify: false,
template: './templates/base.html',
filename: './html/base.html'
}),
new HtmlWebpackPlugin({
inject: false,
minify: false,
template: './templates/custom_macros.html',
filename: './html/custom_macros.html'
}),
],
output: {
path: __dirname + '/static/dist/',
filename: '[name].bundle.js',
publicPath: '/static/dist/'
},
};
pages.forEach(page => {
let entryPath = `./static/js/${page}.js`;
let entryName = page.split('/').pop();
conf.entry[entryName] = entryPath;
conf.plugins.push(new HtmlWebpackPlugin({
hash: true,
inject: false,
minify: false,
template: `./templates/${page}.html`,
filename: `./html/${page}.html`,
chunks: [entryName],
}));
});
module.exports = conf;