n.config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /** @format */
  2. const LoadablePlugin = require('@loadable/webpack-plugin')
  3. const CopyPlugin = require('copy-webpack-plugin')
  4. const AntDesignThemePlugin = require('antd-theme-webpack-plugin')
  5. const path = require('path')
  6. module.exports = {
  7. plugins: [
  8. new LoadablePlugin(),
  9. new CopyPlugin([{
  10. from: './descrtion/',
  11. to: 'assets/descrtion',
  12. toType: 'dir',
  13. },
  14. {
  15. from: './favicon.ico',
  16. to: '/',
  17. },
  18. ]),
  19. new AntDesignThemePlugin({
  20. antDir: path.resolve(__dirname, './node_modules/antd'),
  21. stylesDir: path.resolve(__dirname, './src/styles'),
  22. varFile: path.resolve(__dirname, './src/styles/variables.less'),
  23. mainLessFile: path.join(__dirname, './src/styles/global.less'),
  24. themeVariables: ['@primary-color', '@text-color', '@heading-color'],
  25. indexFileName: 'index.html',
  26. generateOnce: false,
  27. lessUrl: '/assets/descrtion/less.2.7.min.js',
  28. publicPath: '',
  29. }),
  30. ],
  31. css: [{
  32. test: /\.less$/i,
  33. use: [
  34. 'style-loader',
  35. 'css-loader',
  36. {
  37. loader: 'less-loader',
  38. options: {
  39. // modifyVars: {
  40. // 'primary-color': '#12C194',
  41. // },
  42. javascriptEnabled: true,
  43. },
  44. },
  45. ],
  46. },
  47. {
  48. test: /\.css$/i,
  49. use: ['style-loader', 'css-loader'],
  50. },
  51. ],
  52. devServer: {
  53. host: 'localhost',
  54. port: 4001,
  55. proxy: {
  56. '/api': {
  57. changeOrigin: true,
  58. target: 'http://47.108.135.38:41001',
  59. secure: false,
  60. pathRewrite:{
  61. "":""
  62. },
  63. },
  64. },
  65. },
  66. }