有没有办法将 .babelrc 用于开发/测试环境,并使用 SWC 用于生产环境?
我正在使用 Cypress 代码覆盖率插件,该插件依赖于 < a href="https://github.com/istanbuljs/babel-plugin-istanbul" rel="nofollow noreferrer">istanbul 是 SWC 不支持,因此为了使其正常工作,我将其配置为Next.js 项目根目录下的 .babelrc 文件。我只需要开发/测试环境的插件,因此生产环境不需要它。有没有办法配置我的 Next.js 项目,使其在生产中仍然选择 SWC,并在开发/测试环境中忽略 .babelrc?
I am using a Cypress code coverage plugin that depends on istanbul which is not supported by SWC, so in order for it to work, I have it configured in a .babelrc
file at the root of my Next.js project. I only need the plugin for dev/testing environments, so it's not needed for production environment. Is there a way to configure my Next.js project so it still opts in for SWC in production, and ignores the .babelrc in dev/testing environments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论