forked from Pylons/trypyramid.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
99 lines (96 loc) · 2.58 KB
/
webpack.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
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
var path = require('path');
var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var RobotsPlugin = require('@tanepiper/robots-webpack-plugin');
var node_modules_dir = path.resolve(__dirname, 'node_modules');
var templates = require('./webpack.tmpl.config').templates;
var config = {
devtool: 'eval',
entry: {
app: [
'webpack-hot-middleware/client',
path.resolve(__dirname, 'src/main.js')
],
vendors: [
path.resolve(__dirname, 'src/vendors.js')
]
},
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name].[hash].js'
},
resolve: {
root: path.resolve(__dirname, 'src'),
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx'],
modulesDirectories: ['node_modules', 'src'],
alias: {}
},
module: {
noParse: [],
loaders: [{
test: /\.(js|jsx)$/,
exclude: [node_modules_dir],
loaders: ['babel']
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?sourceMap')
}, {
test: /\.scss$/,
loader: ExtractTextPlugin.extract(
'style',
'css?sourceMap!sass?sourceMap&includePaths[]=' + node_modules_dir
)
}, {
test: /\.(png|jpg|ico|gif)$/,
loader: 'file?name=img/[name].[ext]'
}, {
test: /\.html$/,
loader: 'html'
}, {
test: /\.txt$/,
loader: 'raw'
}, {
test: /\.ejs$/,
loader: 'ejs-compiled'
},{
test: /\.(woff|woff2|ttf|eot|svg)(\?.*)?$/,
loader: 'file?name=fonts/[name].[ext]'
}, {
test: require.resolve('jquery'),
loader: 'expose?$!expose?jQuery'
}, {
test: /isotope\-|fizzy\-ui\-utils|desandro\-|masonry|outlayer|get\-size|doc\-ready|eventie|eventemitter/,
loader: 'imports?define=>false&this=>window'
}]
},
plugins: [
new RobotsPlugin(),
new WebpackNotifierPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new webpack.DefinePlugin({
__DEBUG__: true
}),
new webpack.NoErrorsPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.[hash].js'),
new ExtractTextPlugin('[name].[hash].css', {
allChunks: true
})
],
node: {
net: 'empty',
dns: 'empty'
}
};
if (templates) {
templates.forEach(function(template) {
template.mode = 'develop';
config.plugins.push(new HtmlWebpackPlugin(template));
});
};
module.exports = config;