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

styledJsx_cjs.getDefaultExportFromCjs is not a function when building nextjs project #25

Open
AZProductions opened this issue Dec 3, 2023 · 2 comments

Comments

@AZProductions
Copy link

AZProductions commented Dec 3, 2023

Bug report 🐞

Version & Environment

  • @himalaya-ui/core version 0.1.2
  • @next version 13 and 14 using pages router

Expected Behaviour

The behavior I expect is that the build completes. I'm using a standard empty nextjs project, with typescript enabled. The error happens when adding

  <StyledJsxRegistry>
      <ConfigProvider>
        <Component {...pageProps} />
      </ConfigProvider>
    </StyledJsxRegistry>

to _app.tsx

Actual results (or Errors)

I got an error:

$ next build
   Skipping validation of types
 ✓ Linting
   ▲ Next.js 14.0.3

 ✓ Creating an optimized production build
 ✓ Compiled successfully
unhandledRejection TypeError: styledJsx_cjs.getDefaultExportFromCjs is not a function
    at Object.<anonymous> (D:\Github\website\node_modules\@himalaya-ui\core\index.js:5304:44)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at mod.require (D:\Github\website\node_modules\next\dist\server\require-hook.js:64:28)
    at require (node:internal/modules/cjs/helpers:119:18)
    at 5022 (D:\Github\website\.next\server\pages\_app.js:1:80)
    at t (D:\Github\website\.next\server\webpack-runtime.js:1:127) {
  type: 'TypeError'
}
error Command failed with exit code 1.

Using app router, everything works. But with the same code converted into a pages router, this error shows up.
Thanks

@kalysti
Copy link
Contributor

kalysti commented Dec 6, 2023

Hi can u upload a demo project to track this issue. And can u please verify that u call it from a client component since in next 14 all components are server components by default.

@dev-ABsid dev-ABsid closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
@dev-ABsid dev-ABsid reopened this Dec 7, 2023
@dev-ABsid
Copy link
Collaborator

dev-ABsid commented Dec 7, 2023

We recommend using the app router with Next.js versions 13 and 14 for optimal compatibility.

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