-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.production.js
More file actions
87 lines (86 loc) · 2.28 KB
/
webpack.config.production.js
File metadata and controls
87 lines (86 loc) · 2.28 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const path = require('path');
const webpack = require('webpack');
const ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const getPath = (pathToFile) => path.resolve(__dirname, pathToFile);
module.exports = {
devtool: 'source-map',
entry: {
app: [
getPath('./src/app.js'),
getPath('./src/config/production.config.js')
],
vendors: [
'angular',
'angular-ui-router',
'angular-animate',
'angular-sanitize',
'angular-ui-bootstrap',
'angular-local-storage'
]
},
output: {
path: getPath('./dist'),
filename: '[name].[chunkhash].bundle.js'
},
module: {
loaders: [{
test: /\.js$/,
exclude: /(node_modules)/,
loaders: ['babel']
}, {
test: /\.html$/,
loader: 'ngtemplate!html',
exclude: /(index)/
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract('css?sourceMap!less?sourceMap')
},
// FONTS
{
test: /\.woff$/,
loader: 'url?limit=100000&name=./fonts/[name]/[hash].[ext]'
}, {
test: /\.eot$/,
loader: 'file'
}, {
test: /\.svg$/,
loader: 'url?limit=100000&name=./fonts/[name]/[hash].[ext]'
},
// the url-loader uses DataUrls.
// the file-loader emits files.
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url?limit=10000&minetype=application/font-woff'
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file'
}, {
test: /\.(jpg|png|gif)$/,
loader: 'file'
}
]},
plugins: [
new ngAnnotatePlugin({
add: true
// other ng-annotate options here
}),
new webpack.optimize.CommonsChunkPlugin('vendors',
'[name].[chunkhash].vendors.js'),
new ExtractTextPlugin('[name].[chunkhash].style.css'),
// See: https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
template: 'html!./src/index.html'
}),
new CopyWebpackPlugin([{
from: 'config/dist-assets/CNAME'
}, {
from: 'config/dist-assets/manifest.json'
}, {
from: 'src/assets',
to: 'assets'
}])
]
};