4

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?

Eden Chan
  • 111
  • 1
  • 6
  • 1
    It looks like that isn't true. Refer [jsc.preserveAllComments](https://swc.rs/docs/configuration/compilation#jscpreserveallcomments) - "This feature is useful for transpilation that requires comments remain relatively close to the source: e.g. ***files under test with istanbul-ignore coverage annotations***." – Fody Mar 17 '22 at 22:40
  • Thank you for the reference, unfortunately it does not seem to resolve the issue I was having :/ I posted another question following up on this. https://stackoverflow.com/questions/71564063/can-i-get-next-js-to-exclude-babelrc-during-build – Eden Chan Mar 21 '22 at 21:04

0 Answers0