-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
102 lines (90 loc) · 2.98 KB
/
webpack.common.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
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
// To find which plugin(s) is causing DeprecationWarning(s)
// process.traceDeprecation = true;
module.exports = {
entry: {
base: './js/base.js',
program_page: './js/pages/program_page/index.js' ,
tola_management_user: './js/pages/tola_management_pages/user/index.js',
tola_management_organization: './js/pages/tola_management_pages/organization/index.js',
tola_management_program: './js/pages/tola_management_pages/program/index.js',
tola_management_country: './js/pages/tola_management_pages/country/index.js',
audit_log: './js/pages/tola_management_pages/audit_log/index.js',
document_list: './js/pages/document_list/index.js' ,
iptt_quickstart: './js/pages/iptt_quickstart/index.js',
iptt_report: './js/pages/iptt_report/index.js',
logframe: './js/pages/logframe/index.js',
results_framework: './js/pages/results_framework/index.js'
},
output: {
filename: "[name]-[chunkhash].js",
path: path.resolve(__dirname, './build/dist/'),
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
},
},
{
test: /\.s?[ac]ss$/,
use: [
MiniCssExtractPlugin.loader,
{loader: 'css-loader', options: {url: true, sourceMap: true}},
{loader: 'sass-loader', options: {sourceMap: true}}
],
},
{
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: [{
loader: 'file-loader',
options: {
name: '[name]-[hash].[ext]'
}
}]
}
]
},
resolve: {
extensions: ['*', '.js', '.jsx'],
modules: [
path.resolve(__dirname, "js"),
'node_modules'
],
},
plugins: [
// helps avoid chunkhash changing on bundles w/ no mods
new webpack.HashedModuleIdsPlugin(),
// css to their own files
new MiniCssExtractPlugin({filename: '[name]-[contenthash].css'}),
// new webpack.ProvidePlugin({
// jQuery: 'jquery',
// $: 'jquery',
// jquery: 'jquery',
// }),
],
optimization: {
// split manifest out
runtimeChunk: 'single',
// splitChunks: {
// chunks: 'initial',
// },
splitChunks: {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
},
},
externals: {
jquery: 'jQuery',
}
};