vue.config.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. const path = require('path');
  2. var packageConfig = require('./package.json');
  3. function resolve(dir) {
  4. return path.join(__dirname, '..', dir);
  5. }
  6. module.exports = {
  7. devServer: {
  8. port: 8081,
  9. proxy: {
  10. '/2dapi/jsonz': {
  11. // 此处的写法,目的是为了 将 /2dapi/jsonz 替换target的值
  12. // target: 'http://apmstandard/',
  13. target: 'http://82.157.159.41',
  14. // 允许跨域
  15. changeOrigin: true,
  16. ws: true,
  17. pathRewrite: {
  18. '^/2dapi/jsonz': ''
  19. }
  20. },
  21. '/2dapi/spacelist': {
  22. target: 'http://82.157.159.41',
  23. pathRewrite: { '^/2dapi/spacelist': '' },
  24. changeOrigin: true,
  25. secure: false
  26. },
  27. }
  28. },
  29. pages: {
  30. index: {
  31. entry: 'src/main.js',
  32. template: 'public/index.html',
  33. filename: 'index.html'
  34. }
  35. },
  36. publicPath: '/' + packageConfig.name,
  37. //当运行vue-cli-service build时生成的生产环境构建环境的目录。用法和webpack的output.path一样,不要修改output.path
  38. outputDir: packageConfig.name,
  39. //放置打包后生成的静态资源(js、css、img、fonts)的目录,该目录相对于outputDir。
  40. assetsDir: 'public',
  41. //指定生成的index.html的输出路径,相对于outputDir。也可以是一个绝对路径。
  42. indexPath: 'index.html',
  43. // chainWebpack: config => {
  44. // config.module
  45. // .rule('js')
  46. // .include
  47. // .add(resolve('packages'))
  48. // .end()
  49. // .use('babel')
  50. // .loader('babel-loader')
  51. // .tap(options => { return options })
  52. // .end();
  53. // const svgRule = config.module.rule('svg');
  54. // svgRule.uses.clear();
  55. // svgRule
  56. // // .test(/\.svg$/)
  57. // .include
  58. // .add(path.resolve(__dirname,"packages/static/svg"))
  59. // .end()
  60. // .use('vue-loader')
  61. // .loader('vue-loader')
  62. // .end()
  63. // .use('vuecomponent-svg-loader')
  64. // .loader('vuecomponent-svg-loader')
  65. // .end();
  66. // },
  67. configureWebpack: {
  68. resolve: {
  69. alias: {
  70. 'vue$': 'vue/dist/vue.esm.js'
  71. }
  72. }
  73. }
  74. };