简体   繁体   English

如何在 Nuxt.js 中禁用 Babel?

[英]How to disable Babel in Nuxt.js?

Simple question, I know, but googling has turned up nothing.简单的问题,我知道,但谷歌搜索却一无所获。 I've recently been sold on simply omitting Babel transpilation in my projects.我最近因为在我的项目中简单地省略了 Babel 转译而被卖掉了。 I don't have any business need to pander to pre-ES6 era browsers in this day and age!在这个时代,我没有任何业务需要迎合 ES6 时代之前的浏览器!

How do I remove babel from my Nuxt project?如何从我的 Nuxt 项目中删除 babel? Is it as simple as setting babel: false somewhere?是否像在某处设置babel: false一样简单? My package.json is loaded with countless '@babel' packages, I'd love to find a clean way to just remove everything Babel-related.我的 package.json 加载了无数的“@babel”包,我很想找到一种干净的方法来删除所有与 Babel 相关的东西。

How can I do it?我该怎么做?

I guess that this option may help: https://babeljs.io/docs/en/options#ignore我想这个选项可能会有所帮助: https://babeljs.io/docs/en/options#ignore

So, you could probably try this as explained in the nuxt docs :因此,您可以按照nuxt 文档中的说明尝试此操作:

export default {
  ...
  build: {
    babel: {
      babelrc: './.babelrc',
    }
  },
  ...
}

And into your .babelrc file, you may write在你的.babelrc文件中,你可以写

{
  "ignore": [
    "**/*"
  ]
}

Didn't tried it myself but it may be a working idea.自己没有尝试过,但这可能是一个可行的想法。

I set我设置

build: {
    babel: {
      babelrc: false,
    },
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM