deprecated_overflow_webapp/config/webpack/webpack.config.dev.js

106 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2017-12-18 08:06:05 +00:00
const Path = require('path');
const Webpack = require('webpack');
const WebpackMerge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackDashboardPlugin = require('webpack-dashboard/plugin');
const configBase = require('./webpack.config.base.js');
2017-12-21 06:58:35 +00:00
const packages = require('../../package.json');
2017-12-18 08:06:05 +00:00
module.exports = WebpackMerge(configBase, {
2017-12-21 06:58:35 +00:00
entry: {
webapp: [
'react-hot-loader/patch',
Path.resolve(__dirname, '../../src/ts/@overflow/webapp/index.tsx')
],
vendor: Object.keys(packages.dependencies)
},
2017-12-18 08:06:05 +00:00
2017-12-21 05:48:31 +00:00
devtool: 'inline-source-map',
devServer: {
hot: true,
inline: true,
historyApiFallback: true,
publicPath: '/', // match the output `publicPath`
contentBase: [__dirname + '/public', __dirname + '/dist', __dirname + '/node_modules'], // match the output path
host: '127.0.0.1',
port: 9091,
stats: {
colors: true
2017-12-18 08:06:05 +00:00
},
2017-12-21 05:48:31 +00:00
watchOptions: {
ignored: /node_modules/,
},
},
2017-12-21 06:58:35 +00:00
2017-12-21 05:48:31 +00:00
module: {
2017-12-26 10:09:30 +00:00
rules: [
2017-12-21 05:48:31 +00:00
{
test: /\.js$/,
2017-12-26 10:09:30 +00:00
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
enforce: 'pre',
2017-12-21 05:48:31 +00:00
use: [
{
loader: 'source-map-loader'
}
2017-12-18 08:06:05 +00:00
]
2017-12-21 05:48:31 +00:00
},
{
2017-12-26 02:02:48 +00:00
test: /\.tsx?$/,
2017-12-26 10:09:30 +00:00
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
enforce: 'pre',
2017-12-21 05:48:31 +00:00
use: [
{
loader: 'source-map-loader'
}
]
},
{
test: /\.tsx?$/,
2017-12-26 10:09:30 +00:00
include: [
Path.resolve(__dirname, '../../src/')
],
2017-12-21 05:48:31 +00:00
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
use: [
{
2017-12-26 10:09:30 +00:00
loader: 'react-hot-loader/webpack'
2017-12-21 05:48:31 +00:00
},
{
2017-12-26 10:09:30 +00:00
loader: 'awesome-typescript-loader',
options: {
transpileOnly: true,
useTranspileModule: false,
sourceMap: true,
}
2017-12-21 05:48:31 +00:00
},
]
2017-12-26 10:09:30 +00:00
}
]
2017-12-21 05:48:31 +00:00
},
plugins: [
new WebpackDashboardPlugin(),
new Webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
new Webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.js'
}),
new Webpack.optimize.AggressiveMergingPlugin(),
new Webpack.HotModuleReplacementPlugin(),
new Webpack.NamedModulesPlugin(),
new Webpack.NoEmitOnErrorsPlugin(),
new HtmlWebpackPlugin({
template: Path.resolve(__dirname, '../../public/index.html')
}),
]
2017-12-18 08:06:05 +00:00
});