-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathwebpack.config.js
107 lines (105 loc) · 3.68 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
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const mode = process.env.NODE_ENV;
module.exports = [
{
devServer: {
stats: 'minimal',
watchContentBase: true,
writeToDisk: true,
proxy: {'/': 'http://0.0.0.0:5000'}
},
entry: {
main: [
'./flask_project/campaign_manager/index.js',
'./flask_project/campaign_manager/styles/index.scss',
// These are vendor CSS files, but we're including then in the main bundle
'datatables.net-dt/css/jquery.dataTables.min.css',
'datatables.net-rowreorder-dt/css/rowReorder.dataTables.min.css',
'datatables.net-responsive-dt/css/responsive.dataTables.min.css',
]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'flask_project/campaign_manager/static/dist'),
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
filename: '[name].css',
chunkFilename: '[id].css',
ignoreOrder: false, // Enable to remove warnings about conflicting order
}),
],
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: [{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}]
},
{
test: /\.[s]?css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
hmr: process.env.NODE_ENV === 'development',
},
},
'css-loader',
'sass-loader',
],
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
use: { loader: 'url-loader?limit=100000' }
}
],
},
mode
},
{
entry: {
// These scripts are installed from package.json with npm
vendor: [
'jquery/dist/jquery.min.js',
'bootstrap/dist/js/bootstrap.min.js', // TODO: Only include needed comps
'metismenu/dist/metisMenu.min.js',
'leaflet/dist/leaflet.js',
'mapbox-gl/dist/mapbox-gl.js',
'gasparesganga-jquery-loading-overlay/src/loadingoverlay.min.js',
'datatables.net/js/jquery.dataTables.min.js',
'datatables.net-rowreorder/js/dataTables.rowReorder.min.js',
'datatables.net-responsive/js/dataTables.responsive.min.js',
'moment/moment.js',
'datatables.net-plugins/sorting/datetime-moment.js',
'chart.js/dist/Chart.bundle.min.js'
],
// These scripts are committed to this repo
legacy: [
'./flask_project/campaign_manager/static/js/map-campaigner.js',
'./flask_project/campaign_manager/static/libs/geojson-bounds/geojson-bounds.js',
'./flask_project/campaign_manager/static/libs/osmauth.js',
'./flask_project/campaign_manager/static/libs/leaflet-color-markers/leaflet-color-markers.js',
'./flask_project/campaign_manager/static/js/datepicker.min.js',
'./flask_project/campaign_manager/static/js/datepicker.en.js',
'./flask_project/campaign_manager/static/libs/leaflet-search.js',
'./flask_project/campaign_manager/static/libs/js.cookie-2.1.4.min.js',
'./flask_project/campaign_manager/static/libs/jquery-file-upload/jquery.ui.widget.js',
'./flask_project/campaign_manager/static/libs/jquery-file-upload/jquery.fileupload.js'
]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'flask_project/campaign_manager/static/dist'),
},
module: { rules: [{ test: /\.js$/, use: 'script-loader' }] },
mode
}
];