您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

62 行
1.6 KiB

  1. const path = require('path');
  2. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  3. // require('vue-cli-plugin-style-resources-loader')
  4. function resolve(dir) {
  5. return path.join(__dirname, dir)
  6. }
  7. module.exports = {
  8. lintOnSave: false,
  9. devServer: {
  10. // open: true, // 是否自动打开浏览器页面
  11. // host: 'localhost', // 指定使用一个 host,默认是 localhost
  12. port: 8090, // 端口地址
  13. proxy: {
  14. '/fumaoA': {
  15. target: 'https://admintest.malls.iformall.com/api',
  16. changeOrigin: true,
  17. pathRewrite: {
  18. '^/fumaoA': ''
  19. }
  20. },
  21. '/fumao': {
  22. target: 'https://bh5test.malls.iformall.com/B',
  23. changeOrigin: true,
  24. pathRewrite: {
  25. '^/fumao': ''
  26. }
  27. },
  28. }
  29. },
  30. publicPath: './', // 打包后引用的资源路径
  31. // outputDir: 'dist', // 打包目录
  32. configureWebpack: (config) => { // webpack自定义配置
  33. // 生产环境打包分析体积
  34. if (process.env.NODE_ENV === 'production' && process.env.npm_config_report) {
  35. return {
  36. plugins: [
  37. new BundleAnalyzerPlugin()
  38. ]
  39. }
  40. }
  41. },
  42. chainWebpack: config => { // CLI内部webpack配置
  43. const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
  44. types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)))
  45. },
  46. }
  47. // 全局样式 变量、函数
  48. function addStyleResource (rule) {
  49. rule.use('style-resource')
  50. .loader('style-resources-loader')
  51. .options({
  52. patterns: [
  53. resolve('src/styles/variables.less'),
  54. resolve('src/styles/mixin.less'),
  55. ],
  56. })
  57. }