const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const merge = require('webpack-merge'); const nodeExternals = require('webpack-node-externals'); const path = require('path'); const webpack = require('webpack'); const WebpackShellPlugin = require('webpack-shell-plugin'); const common = require('./webpack.common.js'); module.exports = merge.smart(common, { devtool: 'inline-source-map', entry: ['webpack/hot/poll?1000', path.join(__dirname, 'src/main.ts')], externals: [ nodeExternals({ modulesDir: path.resolve(__dirname, '../node_modules'), whitelist: ['webpack/hot/poll?1000'], }), nodeExternals({ whitelist: ['webpack/hot/poll?1000'], }), ], mode: 'development', plugins: [ new CleanWebpackPlugin(), new webpack.HotModuleReplacementPlugin(), new WebpackShellPlugin({ onBuildEnd: ['yarn dev'], }), ], watch: true, });