-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
50 lines (43 loc) · 1.3 KB
/
webpack.config.babel.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
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import webpack from 'webpack';
export default {
entry: ['babel-polyfill', './pages/index.jsx'],
output: {
path: path.join(__dirname, 'build'),
filename: '[name].bundle.js',
},
module: {
loaders: [
{
test: /\.(jsx|js)$/,
loader: 'babel',
include: [
path.join(__dirname, 'web_modules'),
path.join(__dirname, 'pages'),
],
query: { presets: ['latest', 'react'] },
},
{ test: /\.pug$/, loader: 'pug' },
{ test: /\.json$/, loader: 'json' },
{ test: /\.(css|styl)/, loader: ExtractTextPlugin.extract('css!stylus') },
{ test: /\.(svg|ico|ttf|eot|woff|woff2)(\?v=.+)?$/, loader: 'file?name=[path][name].[ext]' },
],
},
plugins: [
new ExtractTextPlugin('[name].css', { allChunks: true }),
new HtmlWebpackPlugin({ template: './pages/index.pug', filename: 'index.html', chunks: ['main'] }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
}),
],
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
'font-awesome.css': 'font-awesome/css/font-awesome.min.css',
},
},
};