This repository was archived by the owner on Feb 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
73 lines (71 loc) · 1.53 KB
/
Copy pathwebpack.config.prod.js
File metadata and controls
73 lines (71 loc) · 1.53 KB
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
'use strict';
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
index: './js/index.js'
},
output: {
path: path.resolve(__dirname, 'dist', 'build'),
filename: '[hash].[name].bundle.js',
chunkFilename: '[hash].[id].bundle.js',
publicPath: 'build/'
},
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader!autoprefixer-loader?browsers=last 5 version'
),
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader!autoprefixer-loader?browsers=last 5 version!less-loader'
),
},
{
test: /\.js$/,
loader: 'babel',
exclude: /(node_modules|bower_components)/,
query: {
presets: [
'es2015'
]
}
},
{
test: /\.(eot|gif|png|svg|ttf|woff|woff2|jpg)\w*/,
loader: 'file'
},
{
test: /\.html$/,
loader: 'raw'
}
]
},
resolve: {
root: [
path.resolve(__dirname),
path.resolve(__dirname, 'js/')
]
},
plugins: [
new ExtractTextPlugin('../[hash].index.bundle.css', {
allChunks: true
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
]
};