-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathwebpack.dev.config.js
69 lines (61 loc) · 1.83 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
// This config is extented from webpack.config.js. We use it for development with webpack-dev-server and autoreload/refresh
var webpack = require('webpack');
var { Config } = require('webpack-config');
var path = require("path");
var mainConfig = new Config().extend("webpack.config");
mainConfig.module.rules = [];
var devConfigExtension = {
entry: {
app: [
// We are using next two entries for hot-reload
'webpack-dev-server/client?http://localhost:3333',
'webpack/hot/only-dev-server',
]
},
output: {
filename: '[name].js',
publicPath: "http://localhost:3333/"
},
// more options here: http://webpack.github.io/docs/configuration.html#devtool
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: /\.module\.less$/,
loaders: ["style-loader", "css-loader", "less-loader"]
},
{
test: /\.module\.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);