-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathwebpack.config.babel.js
50 lines (48 loc) · 1.26 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
50
import path from 'path'
import webpack from 'webpack'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import { WDS_PORT } from './src/shared/config'
import { isProd } from './src/shared/utils'
export default {
entry: [
'react-hot-loader/patch',
'./src/client',
],
output: {
filename: 'js/[name].js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
},
module: {
rules: [
{ test: /\.(js|jsx)$/, use: 'babel-loader', include: /src/ },
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: 'url-loader?limit=10000&mimetype=application/font-woff',
},
{
test: /\.(woff(2)|ttf|eot|svg|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: 'file-loader',
},
],
},
devtool: isProd ? false : 'eval',
resolve: {
extensions: ['.js', '.jsx'],
},
devServer: {
historyApiFallback: true,
port: WDS_PORT,
hot: true,
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src', 'client', 'index.html'),
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
],
}