ckeditor / ckeditor5-react

Official CKEditor 5 React component.
https://ckeditor.com/ckeditor-5
Other
425 stars 99 forks source link

Missing example for building CKEditor5 with Vite in React #544

Closed NikoEscobar closed 1 month ago

NikoEscobar commented 1 month ago

Hi,

I've noticed the documentation provides a guide on how to start a React development project using Vite: CKEditor5 React Integration. However, there doesn't seem to be an example of how to configure the public folder for distribution, similar to what is available in this project: CKEditor5 React Example.

Are there any examples or current guidance on building CKEditor5 using Vite for production?

Thanks!

Witoso commented 1 month ago

Hi, thanks for reaching out. We missed the React example repo during migration in v42, we will archive it to not confuse people.

guidance on building CKEditor5 using Vite for production?

I'm not sure what you mean. AFAIK, npm run build builds the application code in Vite projects usually.

how to configure the public folder for distribution

Do you want to build just the editor code, and place it in public? My curiosity triggers me to ask: why? :)

If you're in the React project, npm is usually the way to install packages, and then a picked bundler merges everything together. There's no need to rely on a separate build step (past v42) for editor, and it can be used with any bundler.

Thanks for answering!

NikoEscobar commented 1 month ago

Thank you @Witoso for your quick response.

I wanted to clarify that my goal was to build the entire React project into the public folder for distribution purposes. After some experimentation, I was able to achieve this by adding a custom configuration in the vite.config.js file, specifically setting the build options and outDir path. I also added a script in package.json to run the build using vite build.

I'm still getting used to Vite, but from what I’ve seen so far, compared to the Webpack setup in the React example repository, Vite feels much more straightforward and less complex to configure.

Thanks again for your help!

Witoso commented 1 month ago

Thank you for more context! I'll make a note to myself regarding this use case and the docs :) I assume you needed something like library mode.