-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
64 lines (63 loc) · 1.75 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
const autoprefixer = require('autoprefixer');
const postcssImport = require('postcss-import');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
module.exports = {
debug: true,
devtool: 'inline-source-map',
context: path.join(__dirname, './client'),
entry: [
'whatwg-fetch',
'webpack-hot-middleware/client?reload=true',
'./index.jsx',
],
output: {
path: path.resolve(__dirname, './.tmp'),
publicPath: '/',
filename: 'bundle.js',
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.HUMAN_API_ID': JSON.stringify(process.env.HUMAN_API_ID || ''),
'process.env.DOMAIN': JSON.stringify(process.env.DOMAIN || ''),
}),
new ExtractTextPlugin('style.css', {
allChunks: true,
}),
new HtmlWebpackPlugin({
template: './index.template.html',
}),
],
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.scss'],
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel-loader'],
}, {
test: /\.css$/,
loaders: ['style', 'css'],
}, {
test: /\.scss$/,
loaders: [
ExtractTextPlugin.extract('style'),
'css?sourceMap',
'postcss',
'sass?sourceMap',
],
}, {
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
loader: 'url?prefix=font/&limit=5000',
}, {
test: /\.(png|jpg|jpeg|gif|woff)$/,
loader: 'url-loader?limit=8192',
}],
},
postcss: () => [postcssImport, autoprefixer],
};