Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in production version minification in next 13, error not in next 12 or dev version of next 13 #43208

Closed
1 task done
cmdcolin opened this issue Nov 22, 2022 · 8 comments
Assignees
Labels
kind: bug Confirmed bug that is on the backlog

Comments

@cmdcolin
Copy link
Contributor

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

yarn next info
yarn run v1.22.19
$ /home/cdiesh/out/node_modules/.bin/next info

    Operating System:
      Platform: linux
      Arch: x64
      Version: #25-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 14 14:06:02 UTC 2022
    Binaries:
      Node: 18.12.1
      npm: 8.19.2
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.0.5-canary.3
      eslint-config-next: 13.0.4
      react: 18.2.0
      react-dom: 18.2.0

Done in 0.97s.

What browser are you using? (if relevant)

Chrome 107.0.5304.110, also Firefox 107.0

How are you deploying your application? (if relevant)

next start

Describe the Bug

I have an app where in dev mode (next dev) the app works, but next build+next start appears to introduce a minification bug. It works with next 12.x but appeared to cause issue with next 13. I don't have a super minimal example (yet) but can try to find one if interested (and similarly, move to another repo like swc if it makes sense?)

Expected Behavior

Minification should produce a valid program

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/cmdcolin/nextjs-13-minify-error

To Reproduce

I reduced the example somewhat to the usage of (our) library https://github.com/GMOD/cram-js/ and made a smaller reproducible example here https://github.com/cmdcolin/nextjs-13-minify-error

The TLDR of how this example was made was just a simple create-next-app with next 13, add @gmod/cram library, add basic usage of this library to pages/index.tsx, and run in production produces the syntax error from bad minification. I did yarn add next@canary and had the same bug

The app works with next 12 though

I could possibly make the reproducible case more minimal if interested

@cmdcolin cmdcolin added the bug Issue was opened via the bug report template. label Nov 22, 2022
@cmdcolin cmdcolin changed the title Error in production version that does not exist in Error in production version minification in next 13, error not in next 12 or dev version of next 13 Nov 22, 2022
@cmdcolin

This comment was marked as off-topic.

cmdcolin referenced this issue in GMOD/jbrowse-components Nov 22, 2022
@ijjk
Copy link
Member

ijjk commented Nov 22, 2022

Hi, can you confirm this issue is still present in v13.0.5-canary.4 of Next.js?

@cmdcolin
Copy link
Contributor Author

I believe it is still happening with canary 4. I pushed this latest canary to my repro

@balazsorban44 balazsorban44 added kind: bug Confirmed bug that is on the backlog area: SWC Minify and removed bug Issue was opened via the bug report template. labels Nov 22, 2022
@balazsorban44
Copy link
Member

I could confirm on canary too, we will have a look, thanks!

@cmdcolin
Copy link
Contributor Author

I reduced the example a little more, so now it is just using @gmod/binary-parser (which is our fork of https://github.com/keichi/binary-parser). Interestingly, I found the normal https://github.com/keichi/binary-parser does not have the issue. both @gmod/binary-parser and binary-parser packages uses eval, and so the issue may be related to minifying the eval'd code presumably

@kdy1
Copy link
Member

kdy1 commented Nov 28, 2022

This will be fixed by swc-project/swc#6521

kdy1 added a commit to swc-project/swc that referenced this issue Nov 29, 2022
@kdy1
Copy link
Member

kdy1 commented Dec 10, 2022

Closing as this is fixed by #43652

@kdy1 kdy1 closed this as completed Dec 10, 2022
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: bug Confirmed bug that is on the backlog
Projects
None yet
Development

No branches or pull requests

4 participants