vue.config.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // const targetUrl = 'http://192.168.1.220/'
  2. const targetUrl = 'http://192.168.1.232/'
  3. // const targetUrl = 'https://www.xyzshops.cn/'
  4. // 椰子临时线上
  5. // const targetUrl = 'http://121.89.196.45/'
  6. module.exports = {
  7. publicPath:'./',
  8. productionSourceMap: false,
  9. pages: {
  10. index: {
  11. // page 的入口
  12. entry: 'src/main.js',
  13. // 模板来源
  14. template: 'public/index.html',
  15. // 在 dist/index.html 的输出
  16. filename: 'index.html',
  17. // 当使用 title 选项时,template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
  18. title: '椰子充值后台管理系统程序',
  19. },
  20. },
  21. devServer: {
  22. open: true,
  23. // host: 'localhost',
  24. host: '192.168.1.146',
  25. port: 3333,
  26. https: false,
  27. //以上的ip和端口是我们本机的;下面为需要跨域的
  28. proxy: {//配置跨域
  29. '/api': {
  30. target: targetUrl,//这里后台的地址模拟的;应该填写你们真实的后台接口
  31. ws: true,
  32. changOrigin: true,//允许跨域
  33. pathRewrite: {
  34. '^/api': ''//请求的时候使用这个api就可以
  35. }
  36. },
  37. }
  38. },
  39. chainWebpack: config => {
  40. config.module
  41. .rule("css")
  42. .test(/\.css$/)
  43. .oneOf("vue")
  44. .resourceQuery(/\?vue/)
  45. .use("px2rem")
  46. .loader("px2rem-loader")
  47. .options({
  48. // remUnit: 192
  49. remUnit: 210
  50. });
  51. },
  52. // 打包去掉console.log
  53. // configureWebpack: (config) => {
  54. // if (process.env.NODE_ENV === 'production') {
  55. // config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
  56. // }
  57. // }
  58. }