-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
73 lines (59 loc) · 2.84 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
// This config is extented from webpack.config.js. We use it for development with webpack-dev-server and autoreload/refresh
var webpackShared = require("./webpack.shared");
var webpack = require('webpack');
var WebpackConfig = require('webpack-config');
var path = require("path");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var mainConfig = new WebpackConfig().extend("webpack.config");
// To work with webpack-dev-server
webpackShared.removeObjectProperties(mainConfig.resolve.alias, ['react']);
mainConfig.resolve.alias["RoboCoachConfig"] = path.join(__dirname, 'js', 'RoboCoachConfig.dev.json');
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/"
},
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: /\.ts(x?)$/, loaders: ['react-hot', 'ts-loader?instance=jsx'], include: path.resolve(__dirname, "js") },
{ test: /\.rt\.html/, loader: "react-templates-loader?targetVersion=0.14.0" /*path.join(__dirname, "rt-loader!ts-loader")*/ },
{ test: /\.css$/, exclude: /\.import\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
{ test: /\.import\.css$/, loader: "style!css", include: path.resolve(__dirname, "js") },
{ test: /\.less$/, exclude: /\.module\.less$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader") },
{ test: /\.module\.less$/, loader: ExtractTextPlugin.extract("style-loader","css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!less-loader"), include: path.resolve(__dirname, "js") },
{ test: /\.(jpg|png|jpg|png|woff|eot|ttf|svg|gif|mp3|mp4|ogv)$/, loader: "file-loader?name=[name].[ext]" },
{ test: /\.json/, loader: "json-loader" },
// for bootstrap-webpack
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
]
},
plugins: [
new ExtractTextPlugin('[name].css', { allChunks: true }),
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
// Used for hot-reload
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
]
};
mainConfig.module.loaders = [];
mainConfig.resolve.alias = {};
mainConfig.plugins = [];
module.exports = mainConfig.merge(devConfigExtension);