-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
61 lines (59 loc) · 1.33 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
var path = require('path');
var context = path.resolve(__dirname, 'public/js');
var output = path.resolve(__dirname, 'public/bundle');
var webpack = require('webpack');
var config = require('./config/config');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var isProduction = config('NODE_ENV', true);
module.exports = {
context: context,
entry: {
article: './article.js',
signup: './signup.js',
main: './main.js'
},
output: {
path: output,
filename: '[name].js',
sourceMapFilename: '[file].map'
},
module: {
loaders: [
{
test: /\.woff2($|(\?v=.*))/,
loader: 'file'
},
{
test: /\.woff($|(\?v=.*))/,
loader: 'file'
},
{
test: /\.ttf($|(\?v=.*))/,
loader: 'file'
},
{
test: /\.eot($|(\?v=.*))/,
loader: 'file'
},
{
test: /\.svg($|(\?v=.*))/,
loader: 'file'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css!resolve-url')
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('style', 'css!resolve-url!less')
}
]
},
devtool: isProduction ? 'source-map' : false,
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin('bundle.css', { allChunks: true }),
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }),
new webpack.optimize.CommonsChunkPlugin('bundle.js')
]
};