ckeditor/ckeditor5-react

TypeError: Cannot read properties of undefined (reading 'createContext') on Vercel deployment

Opened this issue · 0 comments

Description

I am encountering a TypeError: Cannot read properties of undefined (reading 'createContext') error when deploying my project on Vercel. The project works fine locally.

photo_۲۰۲۴-۰۶-۰۷_۱۱-۴۰-۵۶

Steps to Reproduce

  1. Clone the repository from https://github.com/rshorche/Plant-Shop/
  2. Install dependencies using npm install
  3. Deploy the project on Vercel

Expected Behavior

The project should deploy without any errors and work as it does locally.

Actual Behavior

The deployment fails with the following error:

Package.json

{
  "dependencies": {
    "@ckeditor/ckeditor5-build-classic": "^41.4.2",
    "@ckeditor/ckeditor5-react": "^7.0.0",
    ...
  },
  "devDependencies": {
    "vite": "^5.2.0",
    ...
  }
}


import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

export default defineConfig({
  plugins: [react()],
  build: {
    rollupOptions: {
      output: {
        assetFileNames: (assetInfo) => {
          let extType = assetInfo.name.split(".").at(1);
          if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) {
            extType = "img";
          }
          return `assets/${extType}/[name]-[hash][extname]`;
        },
        chunkFileNames: "assets/js/[name]-[hash].js",
        entryFileNames: "assets/js/[name]-[hash].js",
        manualChunks(id) {
          if (id.includes("node_modules")) {
            return id
              .toString()
              .split("node_modules/")[1]
              .split("/")[0]
              .toString();
          }
        },
      },
    },
    chunkSizeWarningLimit: 500,
  },
});

Node.js version: v18.17.1
React version: 18.2.0
Vercel configuration: (if any specific configurations are applied)
Any help or guidance on resolving this issue would be greatly appreciated. Thank you!