webpack.config.dev.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const path = require('path');
  2. const { merge } = require('lodash');
  3. const baseConfig = require('./webpack.config.base');
  4. const mode = 'development';
  5. const entry = {
  6. bundle: path.resolve(__dirname, '..', 'src/index.js'),
  7. };
  8. const alias = {
  9. 'gg-editor': path.resolve(__dirname, '..', 'ggeditor'),
  10. };
  11. const externals = {
  12. 'react-dom': {
  13. root: 'ReactDOM',
  14. commonjs2: 'react-dom',
  15. commonjs: 'react-dom',
  16. amd: 'react-dom',
  17. },
  18. 'react-router-dom': {
  19. root: 'ReactRouterDOM',
  20. commonjs: 'react-router-dom',
  21. commonjs2: 'react-router-dom',
  22. amd: 'react-router-dom',
  23. },
  24. antd: {
  25. root: 'antd',
  26. commonjs: 'antd',
  27. commonjs2: 'antd',
  28. amd: 'antd',
  29. },
  30. };
  31. const devtool = 'cheap-module-eval-source-map';
  32. const devServer = {
  33. contentBase: path.resolve(__dirname, '..', ''),
  34. publicPath: '/dist',
  35. disableHostCheck: true,
  36. };
  37. const output = {
  38. path: path.resolve(__dirname, '..', 'dist'),
  39. filename: '[name].js',
  40. libraryTarget: 'umd',
  41. };
  42. module.exports = merge(baseConfig, {
  43. mode,
  44. entry,
  45. resolve: {
  46. alias,
  47. },
  48. externals,
  49. devtool,
  50. devServer,
  51. output,
  52. });