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

Application error in production build but not dev mode in next@13.4.12 #53273

Closed
1 task done
peterolson opened this issue Jul 27, 2023 · 5 comments · Fixed by #53308 or #53416
Closed
1 task done

Application error in production build but not dev mode in next@13.4.12 #53273

peterolson opened this issue Jul 27, 2023 · 5 comments · Fixed by #53308 or #53416
Assignees
Labels
bug Issue was opened via the bug report template. locked

Comments

@peterolson
Copy link

Verify canary release

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

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Enterprise
    Binaries:
      Node: 16.15.1
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.13-canary.4
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 4.9.5
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/peterolson/next-cytoscape-bug

To Reproduce

Clone the repository at https://github.com/peterolson/next-cytoscape-bug and run npm install, next build and next start.

Uses the following dependency:

"cytoscape": "^3.25.0"

Relevant code as follows:

import { useEffect, useRef } from "react";
import cytoscape from 'cytoscape';

/** Add your relevant code here for the issue to reproduce */
export default function Home() {
  const graphNode = useRef<HTMLDivElement>(null);
  useEffect(() => {
    if (!graphNode.current) return;
    cytoscape({
      container: graphNode.current,
      elements: [
        { data: { id: "a" } },
        { data: { id: "b" } },
        {
          data: {
            id: "ab",
            source: "a",
            target: "b",
          },
        },
      ]
    });
  }, [graphNode]);

  return <div ref={graphNode} style={{ width: 100, height: 100 }} />
}

Describe the Bug

Page renders two-node graph as expected with next dev development mode.

image

When running in production mode using next build and next start, I get this error:

Application error: a client-side exception has occurred (see the browser console for more information).

image

with the following error in the browser console:

TypeError: this.selectionType is not a function

The error does not appear in next version 13.4.8 or below.

Expected Behavior

The expected behavior is seen when running next dev or by using next version 13.4.8 or below.

The following two-node graph should be rendered without any errors:

image

Which browser are you using? (if relevant)

Microsoft Edge Version 115.0.1901.183

How are you deploying your application? (if relevant)

next start

@peterolson peterolson added the bug Issue was opened via the bug report template. label Jul 27, 2023
@lms11

This comment has been minimized.

@reductio
Copy link

Same here. Seems to be a problem with imports. For me I see that an import, that before was an object like { a: fn(), b:() } is now { default: { a: fn(), b: fn() }}, so the destructuring doesn't work as before, explaining the "is not a function" error.

@lms11
Copy link

lms11 commented Jul 28, 2023

Downgrading next version fixed for me locally in prod environment. Dev environment always worked.

Interestingly, deploying to Vercel still doesn't work. Somehow their build is different than building locally.

@kdy1
Copy link
Member

kdy1 commented Jul 28, 2023

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

@kodiakhq kodiakhq bot closed this as completed in #53308 Jul 29, 2023
kodiakhq bot pushed a commit that referenced this issue Jul 29, 2023
### What?

Update `swc_core` to swc-project/swc@00a0575

### Why?

To fix minifier regression.

### How?

 - Closes WEB-1326
 - Fixes #53151
 - Fixes #53286
 - Fixes #53273
@kdy1 kdy1 reopened this Aug 2, 2023
@kodiakhq kodiakhq bot closed this as completed in #53416 Aug 2, 2023
kodiakhq bot pushed a commit that referenced this issue Aug 2, 2023
### What?

Update `swc_core` to swc-project/swc@383509f

### Why?

To fix minifier regression.

### How?

 - Closes WEB-1326
 - Fixes #53151
 - Fixes #53286
 - Fixes #53273
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. 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 Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants