-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
82 lines (75 loc) · 2.17 KB
/
webpack.dev.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
74
75
76
77
78
79
80
81
82
const webpack = require('webpack');
const { Config } = require('webpack-config');
const path = require('path');
const mainConfig = new Config().extend('webpack.config');
mainConfig.module.rules = [];
const devConfigExtension = {
entry: {
app: [
'webpack-dev-server/client?http://0.0.0.0:8080',
'webpack/hot/only-dev-server',
]
},
output: {
filename: '[name].js',
publicPath: "http://0.0.0.0:8080/"
},
devtool: 'eval-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
loader: 'tslint-loader',
options: {
emitErrors: true
},
include: path.join(__dirname, "App")
},
{
test: /\.tsx?$/,
loaders: [
"react-hot-loader",
"babel-loader?cacheDirectory",
"awesome-typescript-loader?tsconfig=tsconfig.webpack.json&useCache=true"
]
},
{
test: /\.css$/,
loaders: [
"style-loader",
"css-loader"
]
},
{
test: /\.less$/,
exclude: /\.component\.less$/,
loaders: [
"style-loader",
"css-loader",
"less-loader"
]
},
{
test: /\.component\.less$/,
loaders: [
"style-loader",
"css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]",
"less-loader"
]
},
{
test: /\.(jpg|png|woff|eot|ttf|svg|gif)$/,
loader: "file-loader?name=[name].[ext]"
}
]
},
plugins: [
// Used for hot-reload
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
DEBUG: true
})
]
};
module.exports = mainConfig.merge(devConfigExtension);