-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
57 lines (45 loc) · 1.99 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
/// <reference path="node_modules/@types/node/index.d.ts"/>
// 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");
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',
].concat(mainConfig.entry.app)
},
output: {
filename: '[name].js',
publicPath: "http://localhost:3333/assets/"
},
resolve: {
alias: mainConfig.resolve.alias
},
// more options here: http://webpack.github.io/docs/configuration.html#devtool
devtool: 'eval-source-map',
watch: true,
module: {
loaders: [
{ test: /\.tsx?$/, loaders: ['react-hot', 'babel?presets[]=es2015-loose', 'ts-loader?configFileName=tsconfig.webpack.json'], include: path.resolve(__dirname, "App") },
{ test: /\.css$/, exclude: /\.import\.css$/, loader: "style!css", include: path.resolve(__dirname, "App") },
{ test: /\.import\.css$/, loader: "style!css", include: path.resolve(__dirname, "App") },
{ test: /\.less$/, exclude: /\.module\.less$/, loader: "style!css!less", include: path.resolve(__dirname, "App") },
{ test: /\.module\.less$/, loader: "style!css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!less", include: path.resolve(__dirname, "App") },
{ test: /\.(jpg|png|jpg|png|woff|eot|ttf|svg|gif)$/, loader: "file-loader?name=[name].[ext]" }
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
// Used for hot-reload
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};
mainConfig.module.loaders = [];
mainConfig.resolve.alias = {};
mainConfig.plugins = [];
module.exports = mainConfig.merge(devConfigExtension);