Skip to content

When I try show slash menu on production, always shows e.fn is not a function error #276

Closed

Description

@nabi-chan

Describe the bug

When I try showing any menu (slash, Toolbar, SideMenu) on production, this error always shown,
It seems tippyjs issue... but I didn't catch any clue, so I wrote this issue on this repo

스크린샷 2023-07-19 13 09 31

(I added some source map for more clue)

To Reproduce

  1. clone this GitHub code
  2. run pnpm build && pnpm start
  3. try slash menu or popup toolbar on browser

Misc

  • Node version: v18.16.1
  • Package manager: pnpm@8.6.8
  • Browser: chrome chrome@114.0.5735.198

Activity

  1. YousefED commented on Jul 19, 2023

    @YousefED
    Collaborator

    Thanks @nabi-chan for this, and thanks for your sponsorship! Very much appreciated.

    We're currently refactoring how the menus / tippy instances get rendered. See #270 . We hope to get this released next week! cc @matthewlipski

  2. joshua-lawrence commented on Jul 20, 2023

    @joshua-lawrence

    Just wanted to add that we are also encountering this issue in our production build!

  3. dlwocks31 commented on Jul 31, 2023

    @dlwocks31

    We are also facing this same issue. Looking forward to the rearchitecture!

  4. matthewlipski commented on Aug 2, 2023

    @matthewlipski
    Collaborator

    Hey everyone, new version is up with the changes to menu rendering! @nabi-chan @joshua-lawrence @dlwocks31 could you guys let me know if you're still encountering this issue on 0.8.3?

  5. dlwocks31 commented on Aug 2, 2023

    @dlwocks31

    @matthewlipski Yes, seems like this particular issue is resolved, thanks a lot! Unfortunately, I am still encountering a similar issue in production build. The error message is same, but it occurs only when minification is on (while in v0.8.2 it didn't matter), so I am guessing two issues should have different root cause. I have posted my error reproduction step in #292

  6. joshua-lawrence commented on Aug 2, 2023

    @joshua-lawrence

    Running on Next.js 13 and pnpm here, its appears the issue is still present for me:
    image

    Behavior is slightly different now though. The page doesn't compile anymore, I'm getting my error page. I'll investigate and see if I can help find a root cause.

  7. joshua-lawrence commented on Aug 2, 2023

    @joshua-lawrence

    There is an empty object in the Tippy plugins array:

    Screenshot 2023-08-02 at 11 25 10 AM

    The particular function above that's throwing the error in @tippyjs/react

    Still digging around..

  8. YousefED commented on Aug 2, 2023

    @YousefED
    Collaborator

    It seems a very weird bug! My guess at this point is the webpack minifier strips away some essential code. Try disabling it like this:

    next.config.js:

    /** @type {import('next').NextConfig} */
    const nextConfig = {
      reactStrictMode: true,
      webpack(webpackConfig) {
        return {
          ...webpackConfig,
          optimization: {
            minimize: false,
          },
        };
      },
    };
    
    module.exports = nextConfig;
    

    does that remove the error?

  9. joshua-lawrence commented on Aug 2, 2023

    @joshua-lawrence

    @YousefED that didn't seem to work for me. Appears this is also being caused by Next SWC and is a known issue for tippy:

    atomiks/tippyjs-react#379 (comment)
    vercel/next.js#53151 (comment)

    Looks like maybe a temporary fix is to disable SWC minification like this:

    module.exports = {
      swcMinify: false,
    }

    https://nextjs.org/docs/architecture/nextjs-compiler#minification

    Sounds like the fix might also be available on the Next canary release, so I'll give that a go first.

  10. joshua-lawrence commented on Aug 2, 2023

    @joshua-lawrence

    Oops, realized I set the config incorrectly on webpack. @YousefED
    With webpack minification disabled, the JavaScript heap runs out of memory during our build. Given this isn't a BlockNote issue, I'll look elsewhere for solutions that don't completely skirt minification and update if I find a workaround that's working for me. Thanks.

    Edit:

    Downgrading to Next 13.4.9 is working for us.

  11. nabi-chan commented on Sep 18, 2023

    @nabi-chan
    Author

    @joshua-lawrence It fixed on next@13.4.19! Also, I think it was fixed. thanks all for support :)

  12. YousefED commented on Sep 18, 2023

    @YousefED
    Collaborator

    Great! Thanks for looping back @nabi-chan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions