-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
112 lines (106 loc) · 2.84 KB
/
webpack.config.js
File metadata and controls
112 lines (106 loc) · 2.84 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
'use strict';
var path = require('path')
, webpack = require('webpack')
, ExtractTextPlugin = require('extract-text-webpack-plugin')
, ManifestPlugin = require('webpack-manifest-plugin')
;
var nodeEnv = process.env.NODE_ENV || 'production';
console.log('» webpack:', nodeEnv);
var filename = '[name]';
if (nodeEnv === 'production') {
filename += '.[contenthash]';
}
var stylusBundler = new ExtractTextPlugin(filename + '.css')
;
var appName = 'aarau'
;
var config = {
output: {
path: path.resolve(__dirname, 'tmp/builds/')
, filename: (nodeEnv === 'production' ?
'[name].[chunkhash].js' : '[name].js')
}
, module: {
loaders: [{
test: /\.css$/
, loader: stylusBundler.extract(['css'])
}, {
test: /\.styl$/
, loader: stylusBundler.extract(['css', 'stylus'])
, include: [
path.resolve(__dirname, appName + '/assets')
]
}, {
test: /\.json$/
, loader: 'json-loader'
}, {
test: /\.js$/
, loader: 'babel-loader'
, include: [
path.resolve(__dirname, appName + '/assets')
, path.resolve(__dirname, 'node_modules/vergil/dst')
, path.resolve(__dirname, 'node_modules/inferno-tree-select/dst')
]
}]
}
, resolve: {
extensions: ['', '.css', '.js']
, alias: {
'crossfilter.js': 'crossfilter2/index.js'
, 'd3.js': 'd3/dist/d3.min.js'
, 'inferno.js': 'inferno/dist/inferno.min.js'
, 'inferno-hyperscript.js':
'inferno-hyperscript/dist/inferno-hyperscript.min.js'
, 'inferno-tree-select.js': 'inferno-tree-select/dst/index.min.js'
, 'i18next.js': 'i18next/i18next.min.js'
, 'i18next-xhr-backend.js': 'i18next-xhr-backend/i18nextXHRBackend.min.js'
, 'i18next-browser-languagedetector.js':
'i18next-browser-languagedetector/i18nextBrowserLanguageDetector.min.js'
, 'vergil.js': 'vergil/dst/index.min.js'
, 'moment\.js$': 'moment/min/moment.min.js'
, 'moment-locale-en-gb\.js$': 'moment/locale/en-gb.js'
, 'styr\.css$': 'styr/dst/styr.min.css'
}
}
, plugins: (function() {
var _plugins = [
stylusBundler
];
_plugins.push(
new webpack.EnvironmentPlugin([
'NODE_ENV'
])
);
_plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(nodeEnv)
})
);
_plugins.push(
new webpack.ProvidePlugin({
'window.moment': 'moment\.js'
})
);
if (nodeEnv === 'production') {
_plugins.push(
new ManifestPlugin({
fileName: 'manifest.json'
})
);
_plugins.push(
new webpack.optimize.UglifyJsPlugin({
debug: false
, minimize: true
, compress: {
warnings: false
}
, output: {
comments: false
}
})
);
}
return _plugins;
})()
};
module.exports = config;