vue.config.js 2.1 KB

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