deprecated_overflow_webapp/config/webpack/webpack.config.dev.js
crusader 5d268cfbf7 ing
2017-12-26 19:09:30 +09:00

106 lines
2.6 KiB
JavaScript

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');
const packages = require('../../package.json');
module.exports = WebpackMerge(configBase, {
entry: {
webapp: [
'react-hot-loader/patch',
Path.resolve(__dirname, '../../src/ts/@overflow/webapp/index.tsx')
],
vendor: Object.keys(packages.dependencies)
},
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
},
watchOptions: {
ignored: /node_modules/,
},
},
module: {
rules: [
{
test: /\.js$/,
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
enforce: 'pre',
use: [
{
loader: 'source-map-loader'
}
]
},
{
test: /\.tsx?$/,
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
enforce: 'pre',
use: [
{
loader: 'source-map-loader'
}
]
},
{
test: /\.tsx?$/,
include: [
Path.resolve(__dirname, '../../src/')
],
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
use: [
{
loader: 'react-hot-loader/webpack'
},
{
loader: 'awesome-typescript-loader',
options: {
transpileOnly: true,
useTranspileModule: false,
sourceMap: true,
}
},
]
}
]
},
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')
}),
]
});