0

Supporting old browsers seems impossible when using nextjs v15 with App router.

browserslist in package.json doesn't do anything, changing tsconfig.json compiler option target doesn't affect build output, changing webpack config in next.config.js doesn't do much either especially with code bundled from node_modules. What is the best way to support old browser (Chrome 59/Opera 46) while using latest nextjs?

Two errors I'm constantly getting are globalThis is not defined and Unexpected token ...

I tried installing polyfills and including them in specific pages and root layout, but it doesn't change anything.

1 Answer 1

0

I am having the same issue with the App router.

To support older browsers, we use both the App- and Pages router. The pages that need to be available for older browsers run smoothly in the Pages router. With this method, we can support browsers down to Chrome 49.

It is possible to remove the globalThis error (from the pages router) by using a global-this script, such as this one: https://github.com/ungap/global-this/blob/master/cjs/index.js

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.