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

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

Open
rshorche opened this issue Jun 7, 2024 · 0 comments

Comments

@rshorche
Copy link

rshorche commented Jun 7, 2024

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!
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

1 participant