vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.01k stars 26.99k forks source link

next/compiled is not es5 compatible #41721

Closed oceandrama closed 1 year ago

oceandrama commented 2 years ago

Verify canary release

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Enterprise
Binaries:
  Node: 16.17.1
  npm: N/A
  Yarn: N/A (I use verson 4.0.0-rc.15 inside a monorepo)
  pnpm: N/A
Relevant packages:
  next: 12.3.1 (I can't use canary version, because it requires react 18)
  eslint-config-next: 12.3.1
  react: 17.0.2
  react-dom: 17.0.2

What browser are you using? (if relevant)

IE 11

How are you deploying your application? (if relevant)

No response

Describe the Bug

After updating from next 10 to next 12 and running es-check es5 \".next/static/**/*.js\ I've got a few errors like this

ES-Check Error:
----
  · erroring file: .next/static/chunks/27112.b269cba35183b25c.js
  · error: SyntaxError: The keyword 'let' is reserved (1:443))
  · see the printed err.stack below for context
----

I made some investigation and it seems like code with troubles is located in next/dist/compiled folder And as for me, if I add next/dist/compiled/stream-browserify in next-transpile-modules config, errors dissapears

There are many ES6 features inside next/compiled (like classes, const, etc.), and it comes into production bundle Is it ok that precompiled libraries are not ES5-compatible?

Expected Behavior

Bundle is fully ES5-compatible and works well in IE 11

Link to reproduction

Unfortunately is doesn't reproduce after create-next-app. Looks like I'm using some features in my project that requires packages in next/compiled folder

balazsorban44 commented 2 years ago

You can also invite me to your repo if it is private, but a public minimal reproduction is the most desireable.

oceandrama commented 2 years ago

@balazsorban44 Unfortunately it's impossible But my issue is all about simple question - Is it ok that precompiled libraries are not ES5-compatible? There are many libraries next using inside browser like stream-browserify and it comes into production bundle

balazsorban44 commented 1 year ago

This issue has been automatically closed because it received no activity for a month and had no reproduction to investigate. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.

github-actions[bot] commented 1 year ago

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.