-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.config.js
67 lines (59 loc) · 1.51 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
var Webpack = require('webpack');
var path = require('path');
var nodeModulesPath = path.resolve(__dirname, 'node_modules');
var buildPath = path.resolve(__dirname, 'public', 'build');
var mainPath = path.resolve(__dirname, 'app', 'main.js');
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var Promise = require('es6-promise').Promise;
var config = {
// We change to normal source mapping
devtool: 'source-map',
entry: mainPath,
output: {
path: buildPath,
filename: 'bundle.js'
},
module: {
loaders: [
// I highly recommend using the babel-loader as it gives you
// ES6/7 syntax and JSX transpiling out of the box
// Let us also add the style-loader and css-loader, which you can
// expand with less-loader etc.
{
test: /\.css$/,
loader: 'style!css'
},
{
test: /\.styl$/,
resolveLoader: { fallback: path.join(__dirname, "node_modules") },
loader: 'style!css!stylus'
},
{
test: /\.js$/,
loaders: ['ng-annotate', 'babel-loader' ],
exclude: [nodeModulesPath]
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
}
,
{
test: /\.jade$/,
loader: "jade-loader"
}
]
},
plugins: [
new Webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
],
resolve: {
alias: {
config: path.join(__dirname, '/app/config', env)
}
}
};
module.exports = config;