overflow_app/config/webpack/webpack.config.dev.js

102 lines
3.0 KiB
JavaScript
Raw Normal View History

2017-06-21 11:24:44 +00:00
const Path = require('path');
const Webpack = require('webpack');
const WebpackMerge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
2017-07-23 14:40:48 +00:00
const WebpackDashboardPlugin = require('webpack-dashboard/plugin');
2017-06-21 11:24:44 +00:00
const configBase = require('./webpack.config.base.js');
module.exports = WebpackMerge(configBase, {
entry: {
app: [
2017-07-28 10:00:07 +00:00
'react-hot-loader/patch'
2017-06-21 11:24:44 +00:00
]
},
2017-07-20 03:20:42 +00:00
2017-06-21 11:24:44 +00:00
devtool: 'inline-source-map',
devServer: {
hot: true,
inline: true,
historyApiFallback: true,
publicPath: '/', // match the output `publicPath`
2017-07-20 03:20:42 +00:00
contentBase: [__dirname + '/public', __dirname + '/dist', __dirname + '/node_modules'], // match the output path
2017-06-21 11:24:44 +00:00
host: '127.0.0.1',
port: 9091,
2017-06-21 11:24:44 +00:00
stats: {
colors: true
},
2017-07-20 03:20:42 +00:00
watchOptions: {
ignored: /node_modules/,
},
2017-06-21 11:24:44 +00:00
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
exclude: [
Path.resolve(__dirname, '../../node_modules/')
]
},
{
enforce: 'pre',
test: /\.tsx?$/,
use: "source-map-loader",
exclude: [
Path.resolve(__dirname, '../../node_modules/')
]
},
2017-07-23 14:40:48 +00:00
// {
// test: /\.tsx?$/,
// loaders: [
// 'awesome-typescript-loader'
// ],
// exclude: [
// Path.resolve(__dirname, '../../node_modules/')
// ],
// include: [
// Path.resolve(__dirname, '../../src/')
// ]
// },
2017-06-21 11:24:44 +00:00
{
test: /\.tsx?$/,
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
include: [
Path.resolve(__dirname, '../../src/')
2017-07-23 14:40:48 +00:00
],
use: [
{
loader: 'react-hot-loader/webpack'
},
{
loader: 'awesome-typescript-loader',
options: {
transpileOnly: true,
useTranspileModule: false,
sourceMap: true,
},
},
],
2017-06-21 11:24:44 +00:00
},
]
},
plugins: [
2017-07-23 14:40:48 +00:00
new WebpackDashboardPlugin(),
2017-06-21 11:24:44 +00:00
new Webpack.HotModuleReplacementPlugin(),
new Webpack.NamedModulesPlugin(),
new Webpack.NoEmitOnErrorsPlugin(),
new HtmlWebpackPlugin({
template: Path.resolve(__dirname, '../../public/index.html')
}),
new Webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.js'
}),
]
});