Vue报错:error Mixed spaces and tabs no-mixed-spaces-and-tabs

背景

在开发过程中使用了ESLint,用来规范代码风格。ESLint是语法检查工具,缺点是对所写代码要求过于严格。这里是因为空格的使用导致的。

npm isntall 就会出现这个问题

image

解决

关闭ESLint的语法检查,配置vue.conf.js

module.exports = {
  publicPath: '/my-app/', // 公共路径
  outputDir: 'dist', // 构建输出目录
  assetsDir: 'static', // 静态资源目录
  indexPath: 'index.html', // 生成的 index.html 模板路径
  lintOnSave: true, // 保存时运行代码检查
  devServer: {
    port: 8080, // 开发服务器端口号
    open: true, // 自动打开浏览器
    proxy: {
      '/api': {
        target: 'http://localhost:3000', // API 代理目标地址
        changeOrigin: true, // 允许改变请求头中的 host
        pathRewrite: {
          '^/api': '' // 重写路径,将 /api 替换为空字符串
        }
      }
    }
  },
  productionSourceMap: false ,// 不生成生产环境的 source map
  lintOnSave: false
};

 

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容