-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
100 lines (97 loc) · 3.79 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
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' );
const StyleLintPlugin = require('stylelint-webpack-plugin');
// const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const path = require( 'path' );
const mgdDashboardCSSPlugin = new ExtractTextPlugin({
filename: './assets/css/mailgun_dashboard.css'
});
// Configuration for the ExtractTextPlugin.
const extractConfig = {
use: [
{ loader: 'raw-loader' },
{
loader: 'postcss-loader',
options: {
plugins: [ require( 'autoprefixer' ) ]
}
},
{
loader: 'sass-loader',
query: {
outputStyle:
'production' === process.env.NODE_ENV ? 'compressed' : 'nested'
}
}
]
};
module.exports = function( env ) {
return {
entry: {
'./assets/js/mailgun_dashboard': './res/js/dashboard.js',
'./assets/js/mailgun_dashboard_settings': './res/js/settings.js'
},
output: {
path: path.resolve( __dirname ),
filename: '[name].js'
},
watch: true,
devtool: 'source-map',
module: {
rules: [
// Setup ESLint loader for JS.
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
emitWarning: true,
}
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
},
},
{
test: /mailgun_dashboard\.s?css$/,
use: mgdDashboardCSSPlugin.extract( extractConfig )
}
]
},
plugins: [
mgdDashboardCSSPlugin,
new StyleLintPlugin({
syntax: 'scss'
}),
// new UglifyJSPlugin({
// uglifyOptions: {
// mangle: {
// // Dont mangle these
// reserved: ['$super', '$', 'exports', 'require']
// }
// },
// sourceMap: true
// }),
new CopyWebpackPlugin([
{ from: './res/img/clouding-2x.gif', to: './assets/img' },
// JS
{ from: './node_modules/bootstrap/dist/js/bootstrap.js', to: './assets/js/third-party' },
{ from: './node_modules/chart.js/dist/Chart.js', to: './assets/js/third-party' },
{ from: './node_modules/daterangepicker/moment.js', to: './assets/js/third-party' },
{ from: './node_modules/daterangepicker/daterangepicker.js', to: './assets/js/third-party' },
{ from: './node_modules/datatables.net/js/jquery.dataTables.js', to: './assets/js/third-party' },
// CSS
{ from: './node_modules/daterangepicker/daterangepicker.css', to: './assets/css/third-party' },
{ from: './node_modules/font-awesome/css/font-awesome.min.css', to: './assets/css/third-party' },
{ from: './node_modules/font-awesome/fonts', to: './assets/css/fonts' },
{ from: './node_modules/bootstrap/dist/css/bootstrap.css', to: './assets/css/third-party' },
{ from: './node_modules/datatables.net-dt/css/jquery.dataTables.css', to: './assets/css/third-party' },
{ from: './node_modules/datatables.net-dt/images', to: './assets/css/images' }
])
]
}
};