-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
72 lines (72 loc) · 2.42 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
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
var exec = require('child_process').exec;
module.exports = {
entry: {
app: ['./prod.js', './js/main.js', 'jquery', 'underscore', 'jquery-ui/ui/widgets/autocomplete', 'bootstrap/dist/css/bootstrap.css', 'jquery-ui/themes/base/core.css', 'jquery-ui/themes/base/menu.css', 'jquery-ui/themes/base/theme.css', 'jquery-ui/themes/base/autocomplete.css', 'mapbox-gl/dist/mapbox-gl.css', 'details-polyfill'],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name]_[chunkhash].js',
publicPath: '/dist'
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendor",
chunks: "all"
}
}
}
},
module: {
rules: [{
test: /\.css$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}
]
}, {
test: /\.(png)$/i,
loader: 'url-loader'
}, {
test: /\.html$/,
use: [{
loader: 'html-loader',
}
],
}
]
},
plugins: [new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery'",
"window.$": "jquery",
Popper: ['popper.js', 'default']
}), new HtmlWebpackPlugin({
template: './tpl/index.html',
filename: '../index.html',
inject: 'body',
}), new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'defer'
}), {
apply: (compiler) => {
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
exec('cd vatsim_parser; ./parse.php', (err, stdout, stderr) => {
if (stdout)
process.stdout.write(stdout);
if (stderr)
process.stderr.write(stderr);
});
});
}
}
],
};