vue.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const path = require('path')
  2. const version = new Date().getTime();
  3. module.exports = {
  4. lintOnSave: false,
  5. publicPath: './', // 基本路径
  6. outputDir: 'dist', // 输出文件目录
  7. assetsDir: './assets',
  8. productionSourceMap: false,
  9. transpileDependencies: ['@supermap/iclient-common', '@supermap/iclient-leaflet'],
  10. devServer: {
  11. host: '0.0.0.0', // can be overwritten by process.env.HOST
  12. port: 8088, // 端口配置
  13. proxy: {
  14. '/api': {
  15. target: 'http://localhost:9999/', // 服务器端接口地址
  16. ws: true, // 如果要代理 websockets,配置这个参数
  17. // 如果是https接口,需要配置这个参数
  18. changeOrigin: true, // 是否跨域
  19. pathRewrite: {
  20. '/api': 'ly/api'
  21. }
  22. }
  23. },
  24. overlay: {
  25. warnings: true,
  26. errors: false
  27. }
  28. },
  29. configureWebpack: {
  30. devtool: 'source-map',
  31. output: {
  32. sourcePrefix: " ",
  33. filename: `js/[name].${version}.js`,
  34. chunkFilename: `js/[name].${version}.js`
  35. },
  36. amd: {
  37. toUrlUndefined: true
  38. },
  39. resolve: {
  40. alias: {
  41. 'vue$': 'vue/dist/vue.esm.js',
  42. '@': path.resolve('src'),
  43. 'txml/txml': 'txml/dist/txml'
  44. }
  45. },
  46. plugins: [
  47. ],
  48. module: {
  49. unknownContextCritical: /^.\/.*$/,
  50. unknownContextCritical: false,
  51. exprContextCritical: false
  52. }
  53. },
  54. // 给css添加版本号
  55. // chainWebpack: config => {
  56. // config.plugin('extract-css').tap(args => [
  57. // {
  58. // filename: `assets/css/[name].${version}.css`,
  59. // chunkFilename: `assets/css/[name].${version}.css`
  60. // }
  61. // ])
  62. // }
  63. }