-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
70 lines (68 loc) · 1.76 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
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const packageData = require('./package.json');
module.exports = {
entry: {
admin: ['./admin/app.js', './admin/assets/admin.scss'],
vendor: ['semantic-ui-css', 'semantic-ui-css/semantic.css', 'jquery']
},
output: {
filename: '[name].bundle.min.js',
path: path.resolve(__dirname, 'dist/admin/assets')
},
devtool: process.env.NODE_ENV === 'production' ? 'source-map' : 'eval',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: packageData.babel
}
},
{
test: /\.(scss|sass)$/,
use: ExtractTextPlugin.extract({
loader: [
{ loader: 'css-loader', options: { minimize: true, sourceMap: true } },
{ loader: 'sass-loader' }
],
})
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
loader: 'css-loader',
options: { minimize: true, sourceMap: true }
})
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/,
use: {
loader: 'file-loader',
options: { name: '[name].[ext]' }
}
}
]
},
plugins: [
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.bundle.min.js',
}),
new ExtractTextPlugin({
filename: '[name].min.css',
allChunks: true,
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_console: false,
},
sourceMap: true
}),
]
};