webpack.dev.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. const path = require('path')
  2. const HtmlWebpackPlugin = require('html-webpack-plugin');
  3. const WebpackMerge = require('webpack-merge')
  4. const baseConfig = require('./webpack.base.js')
  5. module.exports = WebpackMerge.merge(baseConfig, {
  6. mode: 'development',
  7. //开发环境下默认启用cache,在内存中对已经构建的部分进行缓存
  8. //避免其他模块修改,但是该模块未修改时候,重新构建,能够更快的进行增量构建
  9. //属于空间换时间的做法
  10. cache: true,
  11. // 代码入口
  12. entry: {
  13. // 注册界面
  14. main: './src/main.js',
  15. },
  16. output: {
  17. path: path.resolve(__dirname, '../dist'),
  18. publicPath: '/',
  19. filename: 'client-trace-v5-[name].js',
  20. chunkFilename: 'client-trace-v5-chunk-[name].js',
  21. },
  22. watchOptions: {
  23. ignored: ['**/node_modules', '/bat/', '/dist/', '/public/', '/static/', '/test/'],
  24. poll: 2000,
  25. },
  26. devServer: {
  27. port: 8091,
  28. compress: false,
  29. proxy: {
  30. '/api': {
  31. target: 'https://a.leanwo.com/',
  32. ws: false,
  33. changeOrigin: true,
  34. secure:true,
  35. },
  36. '/static': {
  37. target: 'https://a.leanwo.com/',
  38. ws: false,
  39. changeOrigin: true,
  40. secure:true,
  41. },
  42. '/content': {
  43. target: 'https://a.leanwo.com/',
  44. ws: false,
  45. changeOrigin: true,
  46. secure:true,
  47. },
  48. '/dashboard': {
  49. target: 'https://a.leanwo.com/',
  50. ws: false,
  51. changeOrigin: true,
  52. secure:true,
  53. },
  54. '/mock': {
  55. target: 'https://a.leanwo.com/',
  56. ws: false,
  57. changeOrigin: true,
  58. secure:true,
  59. },
  60. '/authApi': {
  61. target: 'https://a.leanwo.com/',
  62. ws: false,
  63. changeOrigin: true,
  64. secure:true,
  65. },
  66. '/Dictionary': {
  67. target: 'https://a.leanwo.com/',
  68. ws: false,
  69. changeOrigin: true,
  70. secure:true,
  71. },
  72. '/Files': {
  73. target: 'https://a.leanwo.com/',
  74. ws: false,
  75. changeOrigin: true,
  76. secure:true,
  77. },
  78. '/WebSocket': {
  79. target: 'https://a.leanwo.com/',
  80. ws: true,
  81. changeOrigin: true,
  82. },
  83. '/TrainVideo': {
  84. target: 'https://a.leanwo.com/',
  85. ws: true,
  86. changeOrigin: true,
  87. },
  88. '/gateway-api': {
  89. target: 'https://a.leanwo.com/',
  90. ws: true,
  91. changeOrigin: true,
  92. secure:true,
  93. },
  94. },
  95. headers: {
  96. 'Access-Control-Allow-Origin': '*',
  97. },
  98. },
  99. devtool: 'source-map',
  100. plugins: (module.exports.plugins || []).concat([
  101. new HtmlWebpackPlugin({
  102. title: 'Prodog',
  103. template: './public/index-debug.html', // 源模板文件
  104. filename: './index.html', // 输出文件【注意:这里的根路径是module.exports.output.path】
  105. chunks: ['main']
  106. })
  107. ])
  108. })