ckeditor/ckeditor5-react

Error: Cannot read properties of undefined (reading 'createContext')

cassio-gamarra opened this issue · 6 comments

image

This errors occurs after build the project. In development time don't happs.

I'm using Vite to build.

My vite.config.ts file:

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
  plugins: [react(), tsconfigPaths()],
  build: {
    rollupOptions: {
      output: {
        manualChunks(id) {
          if (id.includes('node_modules')) {
            return id
              .toString()
              .split('node_modules/')[1]
              .split('/')[0]
              .toString();
          }
        },
      },
    },
  },
});

You need to use our Vite plugin as well.

I add vite plugin e build again:
image

Same error:
image

Using the editor:
image
image

My package.json references "react": "^18.2.0" and the build machine is using node v20.9.0.

As far as I can see, you're using a predefined build, it doesn't require any Vite plugin, as the code is already built in the npm package.

Any idea how i fix the reading 'createContext' error?

I would appreciate it if you could prepare some reproducible code sample for us (repo or zip).