Skip to content

bug: In Ionic 6, IonCol doesn't work in SSR #24446

@SofianeDjellouli

Description

@SofianeDjellouli

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

In Ionic 6, IonCol doesn't work in SSR in Blitz JS.

Expected Behavior

To work in SSR

Steps to Reproduce

  1. Create a Blitz app: https://blitzjs.com/docs/get-started#create-a-new-app
  2. Add Ionic React 6
  3. Render a component using IonCol
  4. You get:
event - compiled successfully
event - build page: /api/rpc/getCurrentUser
wait  - compiling...
event - compiled successfully
08:03:01.785 INFO  getCurrentUser() Starting with input: null 
08:03:01.792 INFO  getCurrentUser() Finished: resolver:0ms serializer:2ms total:3ms 
 
08:03:03.113 INFO  getCurrentUser() Starting with input: null 
08:03:03.119 INFO  getCurrentUser() Finished: resolver:0ms serializer:5ms total:5ms 
 
event - build page: /_error
wait  - compiling...
event - compiled successfully
ReferenceError: window is not defined
    at eval (webpack-internal:///./node_modules/@ionic/core/components/ion-col.js:37:13)
    at Object../node_modules/@ionic/core/components/ion-col.js (/home/sofiane/sandbox/.next/server/pages/index.js:660:1)
    at __webpack_require__ (/home/sofiane/sandbox/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./node_modules/@ionic/react/dist/index.js:47:19)
    at Object../node_modules/@ionic/react/dist/index.js (/home/sofiane/sandbox/.next/server/pages/index.js:1584:1)
    at __webpack_require__ (/home/sofiane/sandbox/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./app/core/components/GridExample.tsx:7:70)
    at Object../app/core/components/GridExample.tsx (/home/sofiane/sandbox/.next/server/pages/index.js:66:1)
    at __webpack_require__ (/home/sofiane/sandbox/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./app/pages/index.tsx:21:90)

Code Reproduction URL

https://github.com/SofianeDjellouli/blitz-ionic6-issue-reproduction

Ionic Info

[WARN] You are not in an Ionic project directory. Project context may be missing.

Ionic:

   Ionic CLI : 5.4.16

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v17.1.0
   npm    : 6.14.15
   OS     : Linux 4.19

Additional Information

It has nothing to do with it, but I had to use next-transpile-modules since Ionic 6 is using ES6 modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions