Haobo Zhang
Haobo Zhang

Reputation: 141

How to build NextJS to es5?

Is there anyway to build a nextjs app for es5? I only need the exported static javascript to be es5 since I need to support a device that only has es5. I tried adding a babel polyfill, but when I ran es-check on _app file, it still had arrow functions and es6 features.

Upvotes: 5

Views: 2670

Answers (1)

vighnesh153
vighnesh153

Reputation: 5388

You can use the browserslist configuration to do that.

In your package.json, add the following:

{
  "browserslist": [
    ">0.3%, defaults, supports es5"
  ]
}

Upvotes: 5

Related Questions