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

Dynamic is not working as expected in next-emotion-typescript #835

Open
leeonon opened this issue Oct 26, 2023 · 2 comments
Open

Dynamic is not working as expected in next-emotion-typescript #835

leeonon opened this issue Oct 26, 2023 · 2 comments

Comments

@leeonon
Copy link

leeonon commented Oct 26, 2023

I'm using the next-emotion-typescript example, but next dynamic isn't working as expected, and it doesn't render anything.

import dynamic from 'next/dynamic'

const DynamicComponent = dynamic(() => import('./dynamic-component'), {
  ssr: false,
  loading: () => <div>Loading...</div>,
})

export default function About() {
  return (
    <div>
      <h1>About</h1>
      <DynamicComponent />
    </div>
  )
}

Expected:

But actually:

I tried commenting out the webpack configuration in the withTwin.js file and the reference to twin.macro, and dynamic worked fine.

  // config.module.rules.push({
  //   test: /\.(tsx|ts)$/,
  //   include: includedDirs,
  //   use: [
  //     patchedDefaultLoaders,
  //     {
  //       loader: 'babel-loader',
  //       options: {
  //         sourceMaps: dev,
  //         plugins: [
  //           require.resolve('babel-plugin-macros'),
  //           require.resolve('@emotion/babel-plugin'),
  //           [
  //             require.resolve('@babel/plugin-syntax-typescript'),
  //             { isTSX: true },
  //           ],
  //         ],
  //       },
  //     },
  //   ],
  // })

I'm not sure if it's related to this issue: https://github.com/ben-rogerson/twin.macro/issues/788。

Here is a repository to reproduce the issue: https://github.com/leeonon/next-emotion-typescript-dynamic-issues

@mthmcalixto
Copy link

It stopped working at https://github.com/vercel/next.js/releases/tag/v13.5.7-canary.26, Works up to .25

@bartekparysek
Copy link

I've got same issues but with next 12.2.5 but the project won't compile with

Error: 
  x next/dynamic options must be an object literal.
  | Read more: https://nextjs.org/docs/messages/invalid-dynamic-options-type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants