This repository has been archived by the owner on Dec 13, 2021. It is now read-only.
/
webpack.config.js
73 lines (72 loc) · 1.95 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
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
devtool: 'eval-source-map',
resolve: {
alias: {
src: path.resolve(__dirname, 'src'),
},
},
entry: [
`webpack-dev-server/client?http://localhost:9000`,
'webpack/hot/only-dev-server',
path.resolve(__dirname, 'dev/main.jsx'),
],
module: {
preLoaders: [
{
test: /\.jsx?$/,
loader: 'eslint-loader',
exclude: /node_modules/,
},
],
loaders: [
{
test: /\.jsx?$/,
loader: 'react-hot',
exclude: /node_modules/,
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: [
'react',
],
plugins: [
'transform-inline-imports-commonjs',
'transform-class-properties',
'transform-object-rest-spread',
],
},
},
{
test: /.*\.(gif|png|jpe?g|svg)$/,
loader: 'file?hash=sha512&digest=hex&name=[hash].[ext]',
exclude: /node_modules/,
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass'],
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
}),
],
devServer: {
colors: true,
historyApiFallback: true,
hot: true,
inline: true,
progress: true,
host: 'localhost',
port: 9000,
},
}