-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-dev-server.config.js
66 lines (63 loc) · 1.55 KB
/
webpack-dev-server.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
const webpack = require('webpack');
const path = require('path');
const buildPath = path.resolve(__dirname, 'build');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const TransferWebpackPlugin = require('transfer-webpack-plugin');
const config = {
entry: [
// 'webpack/hot/dev-server',
'webpack-dev-server/client?http://0.0.0.0:3000',
'webpack/hot/only-dev-server',
'whatwg-fetch',
path.resolve('./src/index.tsx'),
],
devServer: {
contentBase: '.',
devtool: 'eval-source-map',
hot: true,
inline: true,
port: 3000,
host: 'localhost',
historyApiFallback: true,
},
devtool: 'eval-source-map',
output: {
path: buildPath,
filename: 'app.js',
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
// new TransferWebpackPlugin([
// {from: 'www'},
// ], path.resolve(__dirname, 'src')),
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['react-hot-loader/webpack', 'babel-loader'],
exclude: [nodeModulesPath],
},
{
test: /\.tsx?$/,
loaders: ['react-hot-loader/webpack', 'ts-loader'],
exclude: [nodeModulesPath],
},
],
preLoaders: [
{ test: /\.js$/, loader: "source-map-loader" }
],
},
resolve: {
extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"],
alias: {
react: path.resolve('./node_modules/react'),
}
},
externals: {
// "react": "React",
// "react-dom": "ReactDOM"
},
};
module.exports = config;