Next.js Discord

Discord Forum

Transpiling the dist/ directory using babel/swc to enable optional chaining on es5

Unanswered
Orinoco Crocodile posted this in #help-forum
Open in Discord
Orinoco CrocodileOP
Is it possible to run swc on a next dist/ folder to convert modern features to es5?

2 Replies

American black bear
hey, you can just set the browserlist you need in the package.json
https://nextjs.org/docs/architecture/supported-browsers
for es5 you could do something like
"browserslist": [
    ">0.3%, defaults, supports es5"
  ]
Orinoco CrocodileOP
Great, thanks man