development.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Note: You must restart bin/webpack-dev-server for changes to take effect
  2. const { merge } = require('webpack-merge');
  3. const { settings, output } = require('./configuration');
  4. const sharedConfig = require('./shared');
  5. const watchOptions = {};
  6. if (process.env.VAGRANT) {
  7. // If we are in Vagrant, we can't rely on inotify to update us with changed
  8. // files, so we must poll instead. Here, we poll every second to see if
  9. // anything has changed.
  10. watchOptions.poll = 1000;
  11. }
  12. module.exports = merge(sharedConfig, {
  13. mode: 'development',
  14. cache: true,
  15. devtool: 'cheap-module-eval-source-map',
  16. stats: {
  17. errorDetails: true,
  18. },
  19. output: {
  20. pathinfo: true,
  21. },
  22. devServer: {
  23. clientLogLevel: 'none',
  24. compress: settings.dev_server.compress,
  25. quiet: settings.dev_server.quiet,
  26. disableHostCheck: settings.dev_server.disable_host_check,
  27. host: settings.dev_server.host,
  28. port: settings.dev_server.port,
  29. https: settings.dev_server.https,
  30. hot: settings.dev_server.hmr,
  31. contentBase: output.path,
  32. inline: settings.dev_server.inline,
  33. useLocalIp: settings.dev_server.use_local_ip,
  34. public: settings.dev_server.public,
  35. publicPath: output.publicPath,
  36. historyApiFallback: {
  37. disableDotRule: true,
  38. },
  39. headers: settings.dev_server.headers,
  40. overlay: settings.dev_server.overlay,
  41. stats: {
  42. entrypoints: false,
  43. errorDetails: false,
  44. modules: false,
  45. moduleTrace: false,
  46. },
  47. watchOptions: Object.assign(
  48. {},
  49. settings.dev_server.watch_options,
  50. watchOptions,
  51. ),
  52. writeToDisk: filePath => /ocr/.test(filePath),
  53. },
  54. });