forked from developersociety/commonslibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.js
82 lines (76 loc) · 1.74 KB
/
webpack.production.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
const path = require('path');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
context: __dirname,
entry: {
main: [
'./static/src/js/index',
'./static/src/scss/styles.scss'
],
nav: [
'./static/src/js/nav'
],
home: [
'./static/src/js/index',
'./static/src/js/home',
'./static/src/scss/styles.scss'
],
forms: [
'./static/src/js/forms/forms',
'./static/src/js/forms/tags',
'./static/src/js/forms/privacy'
],
resource: [
'./static/src/js/resource/resource_detail'
]
},
output: {
path: path.resolve('./static/dist/'),
filename: "[name].js"
},
plugins: [
new BundleTracker({filename: './webpack-production-stats.json'}),
new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin({
filename: '[name].css',
allChunks: true,
})
],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/,
exclude: '/node_modules/',
loader: ExtractTextPlugin.extract({
use: ['css-loader?importLoaders=1'],
})
},
{
test: /\.scss$/,
exclude: '/node_modules/',
loader: ExtractTextPlugin.extract([
'css-loader',
'sass-loader'
])
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'file-loader',
options: {
name: 'assets/[name].[ext]'
}
}
]
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx']
}
}