-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.production.config.js
72 lines (63 loc) · 2.27 KB
/
webpack.production.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
71
72
const webpack = require('webpack');
const ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const APP = __dirname + '/app';
module.exports = {
// config goes here
context: APP,
entry: {
app: ['./core/bootstrap.js'],
vendors: [
'angular',
'angular-route',
'angular-animate',
'd3',
'angular-ui-bootstrap'
]
},
module: {
loaders: [
{ test: /\.js$/, loader: 'ng-annotate!babel?presets[]=es2015', exclude: /node_modules/ },
{ test: /\.js$/, loader: 'eslint-loader', exclude: /node_modules/ },
{ test: /\.json$/, loader: 'file-loader?name=[name].[ext]', exclude: /node_modules/ },
{ test: /\.html$/, loader: 'ng-cache?prefix=[dir]/[dir]', exclude: /index.html/},
// Needed for the css-loader when [bootstrap-webpack](https://github.com/bline/bootstrap-webpack)
// loads bootstrap's css.
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&minetype=application/font-woff&name=fonts/[name].[ext]' },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader?name=img/[name].[ext]' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css')},
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css!sass')},
{ test: /\.(jpg|png|gif|ico)$/, loader: 'file-loader?name=img/[name].[ext]'}
]
},
plugins: [
new webpack.ProvidePlugin({
d3: 'd3'
}),
new webpack.DefinePlugin({
__LOGGING__: false,
__PROXY__: true,
__PROXY_URL__: JSON.stringify(require('./production.conf.json').proxyUrl),
__SESSION_STORAGE__: false,
__SHOW_ENDPOINT__: true,
__VERSION__: JSON.stringify(require('./package.json').version)
}),
new ngAnnotatePlugin({
add: true
}),
new ExtractTextPlugin('styles.css', { allChunks: true }),
new webpack.optimize.CommonsChunkPlugin('vendors', 'js/vendors.js'),
new HtmlWebpackPlugin({
title: 'LD-VOWL',
template: 'index.ejs',
favicon: __dirname + '/app/favicon.ico'
})
],
output: {
path: __dirname + '/dist',
filename: 'js/bundle.js'
},
devtool: false
};