webpack-hmr.config.js 637 B

1234567891011121314151617181920212223
  1. /* eslint-disable*/
  2. const nodeExternals = require('webpack-node-externals');
  3. const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');
  4. module.exports = function (options, webpack) {
  5. return {
  6. ...options,
  7. entry: ['webpack/hot/poll?100', options.entry],
  8. externals: [
  9. nodeExternals({
  10. allowlist: ['webpack/hot/poll?100'],
  11. }),
  12. ],
  13. plugins: [
  14. ...options.plugins,
  15. new webpack.HotModuleReplacementPlugin(),
  16. new webpack.WatchIgnorePlugin({
  17. paths: [/\.js$/, /\.d\.ts$/],
  18. }),
  19. new RunScriptWebpackPlugin({ name: options.output.filename }),
  20. ],
  21. };
  22. };