vue.config.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. const path = require('path');
  2. var webpack = require('webpack');
  3. module.exports = {
  4. // 基本路径 直接使用 / 即可
  5. publicPath: '/',
  6. // 输出文件目录
  7. outputDir: process.env.NODE_ENV === 'production' ? 'dist' : 'devdist',
  8. // eslint-loader 是否在保存的时候检查
  9. lintOnSave: false,
  10. /**
  11. * webpack配置,see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  12. **/
  13. configureWebpack: (config) => {
  14. config.resolve = { // 配置解析别名
  15. extensions: ['.js', '.json', '.vue'],
  16. alias: {
  17. '@': path.resolve(__dirname, './src'),
  18. 'public': path.resolve(__dirname, './public'),
  19. '@c': path.resolve(__dirname, './src/components'),
  20. 'common': path.resolve(__dirname, './src/common'),
  21. 'api': path.resolve(__dirname, './src/api'),
  22. 'views': path.resolve(__dirname, './src/views'),
  23. 'data': path.resolve(__dirname, './src/data'),
  24. },
  25. },
  26. plugins => {
  27. plugins.ProvidePlugin = {
  28. 'window.Quill': 'quill/dist/quill.js',
  29. 'Quill': 'quill/dist/quill.js'
  30. }
  31. }
  32. },
  33. chainWebpack: config => {
  34. config.plugin('provide').use(webpack.ProvidePlugin, [{
  35. 'window.Quill': 'quill'
  36. }])
  37. },
  38. // 生产环境是否生成 sourceMap 文件
  39. productionSourceMap: false,
  40. // css相关配置
  41. // use thread-loader for babel & TS in production build
  42. // enabled by default if the machine has more than 1 cores
  43. parallel: require('os').cpus().length > 1,
  44. /**
  45. * PWA 插件相关配置,see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
  46. */
  47. pwa: {},
  48. // webpack-dev-server 相关配置
  49. devServer: {
  50. open: false, // 编译完成是否打开网页
  51. host: '0.0.0.0', // 指定使用地址,默认localhost,0.0.0.0代表可以被外界访问
  52. port: 8000, // 访问端口
  53. https: false, // 编译失败时刷新页面
  54. proxy: {
  55. '/api': {
  56. target: 'http://10.201.2.116/k3cloud/services/LTTCWebService.asmx/ReceiveBleachDyeGanttParam',
  57. changeOrigin: true,
  58. pathRewrite: {
  59. '^/api': ''
  60. }
  61. }
  62. },
  63. },
  64. /**
  65. * 第三方插件配置
  66. */
  67. pluginOptions: {},
  68. }