-
Notifications
You must be signed in to change notification settings - Fork 12
/
client.dev.js
86 lines (85 loc) · 2.21 KB
/
client.dev.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
const path = require('path')
const webpack = require('webpack')
const WriteFilePlugin = require('write-file-webpack-plugin')
const ExtractCssChunks = require('extract-css-chunks-webpack-plugin')
const Dotenv = require('dotenv-webpack')
const autoprefixer = require('autoprefixer')
const ServiceWorkerPlugin = require('serviceworker-webpack-plugin')
module.exports = {
name: 'client',
target: 'web',
devtool: 'inline-source-map',
mode: 'development',
entry: [
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=false&quiet=false&noInfo=false',
'react-hot-loader/patch',
path.resolve(__dirname, '../src/client.js')
],
output: {
filename: '[name].js',
chunkFilename: '[name].js',
path: path.resolve(__dirname, '../build'),
publicPath: '/'
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.scss$/,
use: [
ExtractCssChunks.loader,
{
loader: 'css-loader',
query: {
modules: true,
localIdentName: '[name]__[local]--[hash:base64:5]'
}
},
'sass-loader',
{
loader: 'postcss-loader',
options: {
plugins: () => [autoprefixer({ browsers: 'last 2 versions' })]
}
}
]
},
{
test: /\.(jpg|png|gif|svg|ico)$/,
use: [
{
loader: 'url-loader'
}
]
}
]
},
resolve: {
alias: {
components: path.resolve(__dirname, '..', 'src/components/'),
reducers: path.resolve(__dirname, '..', 'src/redux/')
},
extensions: ['.json', '.js', '.jsx']
},
plugins: [
new WriteFilePlugin(),
new ExtractCssChunks(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.ProvidePlugin({
fetch: 'isomorphic-fetch'
}),
new Dotenv({
path: path.resolve(__dirname, '..', '.env'),
safe: false
}),
new ServiceWorkerPlugin({
entry: path.join(__dirname, '..', 'src/sw.js'),
excludes: ['*hot-update*', '**/*.map', '**/stats.json']
})
]
}