webpack.config.dev.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const webpack = require('webpack')
  2. const merge = require('webpack-merge')
  3. const MiniCssExtractPlugin = require('mini-css-extract-plugin')
  4. const base = require('./webpack.config')
  5. module.exports = merge(base, {
  6. mode: 'development',
  7. // Enable accurate source maps for dev
  8. devtool: 'source-map',
  9. plugins: [
  10. // Extract CSS to a separate file (rather than inlining to a <style> tag)
  11. new MiniCssExtractPlugin({
  12. // Output to public/stylesheets directory
  13. filename: 'stylesheets/[name].css',
  14. }),
  15. // Disable React DevTools if DISABLE_REACT_DEVTOOLS is set to "true"
  16. process.env.DISABLE_REACT_DEVTOOLS === 'true' &&
  17. new webpack.DefinePlugin({
  18. __REACT_DEVTOOLS_GLOBAL_HOOK__: '({ isDisabled: true })',
  19. }),
  20. ].filter(Boolean),
  21. devServer: {
  22. // Expose dev server at www.dev-overleaf.com
  23. host: '0.0.0.0',
  24. port: 3808,
  25. public: 'www.dev-overleaf.com:443',
  26. // Customise output to the (node) console
  27. stats: {
  28. colors: true, // Enable some coloured highlighting
  29. // Hide some overly verbose output
  30. performance: false, // Disable as code is uncompressed in dev mode
  31. hash: false,
  32. version: false,
  33. chunks: false,
  34. modules: false,
  35. // Hide copied assets from output
  36. excludeAssets: [/^js\/ace/, /^js\/libs/, /^js\/cmaps/],
  37. },
  38. },
  39. })