Skip to content

How can I customize SWC configuration to target ES2015+? #342

Closed Answered by hueter
hueter asked this question in Q&A
Discussion options

You must be logged in to vote

Update: I actually found a workaround that transpiles to ES2015+, just by setting the browserslist config in the env.targets:

swc.config.js

const customConfig = {
  options: {
    jsc: {/* etc */},
    env: {
      // this overrides the Shakapacker defaults
      coreJs: null,
      exclude: [],
      mode: "entry",
      // this transpiles to ES2021+
      targets: "last 2 years",
    },
  },
};

module.exports = customConfig;

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ahangarha
Comment options

Answer selected by Judahmeek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants