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

[Bug]: TypeCheck failure when building / prerendering using NextJS v14.2.3 #3202

Open
2 of 3 tasks
jaydubb12 opened this issue Jun 21, 2024 · 0 comments
Open
2 of 3 tasks
Labels
bug Something isn't working

Comments

@jaydubb12
Copy link

Describe the Bug

When user builds a NextJS project and utilizes the provided configuration the page pre-rendering & typeCheck will fail will fail due to an undefined property as outlined in the error below.

NOTE, there are other Typechecking issues with NextJS and Browserlist, but I have removed that dependency and config to rule that out.

Compilation Error

⨯ TypeError: Cannot read properties of undefined (reading 'xs') ```

### NextJS Config

## NextJS Config
```  experimental: {
   optimizePackageImports: ['@storefront-ui/react'],  ```


### Expected behavior

TypeChecking would be performed successfully

### Steps to reproduce

1. Install Next v14.1+
2. Install @storefront-iu/react as a dependency
3. Set the NextJS config file to utilize the following configs

experimental: {
optimizePackageImports: ['@storefront-ui/react'],

transpilePackages: ['@storefront-ui/react'], // transpile and bundle dependencies from local packages


4. Execute build command

### SFUI version

@storefront-ui/react2.6.0 and 2.6.3

### Framework

NextJS v14.1.0 and v14.2.3

### Node version

20.11.0

### Browser

Chrome 

### OS

MacOS Sonoma 14.5

### Relevant log output

```shell
Next.js 14.1.0
   - Local:        http://localhost:3000
   - Environments: .env

> [PWA] PWA support is disabled
> [PWA] PWA support is disabled
 ✓ Ready in 3.8s
 ○ Compiling /middleware ...
 ✓ Compiled /middleware in 743ms (109 modules)
 ○ Compiling / ...
 ✓ Compiled / in 8s (1422 modules)
 ⨯ node_modules/@storefront-ui/react/dist/components/SfLoaderCircular/SfLoaderCircular.cjs.js (1:128) @ xs
 ⨯ TypeError: Cannot read properties of undefined (reading 'xs')
    at __webpack_require__ (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/webpack-runtime.js:33:42)
    at __webpack_require__ (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/webpack-runtime.js:33:42)
    at __webpack_require__ (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/webpack-runtime.js:33:42)
    at eval (./components/ExistingSelectionModal/ExistingSelectionModal.tsx:9:104)
    at (ssr)/./components/ExistingSelectionModal/ExistingSelectionModal.tsx (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/app/(default)/page.js:348:1)
    at __webpack_require__ (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/webpack-runtime.js:33:42)
    at eval (./builder-registry.ts:8:115)
    at (ssr)/./builder-registry.ts (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/app/(default)/page.js:293:1)
    at __webpack_require__ (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/webpack-runtime.js:33:42)
    at eval (page.tsx:10:75)
    at (ssr)/./app/(default)/page.tsx (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/app/(default)/page.js:271:1)
    at __webpack_require__ (/Users/jasonwolf/IdeaProjects/VirtualSelection/packages/showroom-ui/.next/server/webpack-runtime.js:33:42)
    at JSON.parse (<anonymous>)
null

Able to fix / change the documentation?

  • Yes
  • No

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jaydubb12 jaydubb12 added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant