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

parcel support #986

Closed
ocavue opened this issue Apr 22, 2018 · 11 comments
Closed

parcel support #986

ocavue opened this issue Apr 22, 2018 · 11 comments
Labels
type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@ocavue
Copy link

ocavue commented Apr 22, 2018

This issue is a feature request.

It seems that ckeditor 5 only support webpack for now. Does ckeditor have any plan to support parcel?

BTW, if you are interesting to it, there is the error when I try to build ckeditor 5 framework with parcel:

$ ./node_modules/.bin/parcel index.html
Server running at http://localhost:1234
🚨  /my_project/node_modules/@ckeditor/ckeditor5-ui/src/componentfactory.js: /my_project/node_modules/@ckeditor/ckeditor5-ui/src/componentfactory.js: unknown Statement of type "ForOfStatement"
    at Emitter.Ep.explodeStatement (/my_project/node_modules/regenerator-transform/lib/emit.js:648:13)
    at /my_project/node_modules/regenerator-transform/lib/emit.js:344:12
    at Array.forEach (<anonymous>)
    at Emitter.Ep.explodeStatement (/my_project/node_modules/regenerator-transform/lib/emit.js:343:22)
    at Emitter.Ep.explode (/my_project/node_modules/regenerator-transform/lib/emit.js:298:40)
    at PluginPass.exit (/my_project/node_modules/regenerator-transform/lib/visit.js:122:15)
    at newFn (/my_project/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/my_project/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/my_project/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/my_project/node_modules/babel-traverse/lib/path/context.js:117:8)

If you'd like to see this issue resolved please react with 👍 to this post.

@Reinmar
Copy link
Member

Reinmar commented Apr 23, 2018

Hi!

The Advanced setup guide explains the minimal configuration which is needed to build CKEditor 5. It talks about webpack, but these 3 points should help you understand what needs to be configured in general:

You can now configure webpack. There are a couple of things that you need to take care of when building CKEditor:

  • Handling CSS files of the CKEditor theme. They are included in the CKEditor sources using import 'path/to/styles.css' statements, so you need proper loaders.
  • Similarly, you need to handle bundling SVG icons, which are also imported directly into the source. For that you need the raw-loader.
  • Finally, to localize the editor you need to use the @ckeditor/ckeditor5-dev-webpack-plugin webpack plugin.

I don't know parcel but assuming that it implements some similar mechanism to webpack's loaders, you can easily handle the point about SVG files.

The CSS files are a bigger problem. We use PostCSS with a couple of standard plugins. However, we also needed to implement our own custom plugin for it. @oleq will tell you more what it does and whether it's possible to leave without it.

Finally, there's localisation. If you want to use CKEditor 5 in English, then you don't need to do anything. If you, however, want to have it localised, then you'd need to port the @ckeditor/ckeditor5-dev-webpack-plugin to parcel. I'm afraid that this may be tough.


Please note that unless you want to integrate with CKEditor 5 very closely, there are other methods to include CKEditor 5 into your app. See my comments in #987 (comment).

@Reinmar Reinmar added type:feature This issue reports a feature request (an idea for a new functionality or a missing option). status:confirmed labels Apr 23, 2018
@Reinmar Reinmar added this to the unknown milestone Apr 23, 2018
@oleq
Copy link
Member

oleq commented Apr 23, 2018

The CSS files are a bigger problem. We use PostCSS with a couple of standard plugins. However, we also needed to implement our own custom plugin for it. @oleq will tell you more what it does and whether it's possible to leave without it.

It's the theme importer plugin we're talking about.

Every single UI component of the editor comes with some CSS. But that's only the wireframe. To make it look like an actual button/dropdown/input, a theme is required.

ATM we have only one theme https://github.com/ckeditor/ckeditor5-theme-lark. What the theme importer plugin does is glue the wireframe CSS files with the theme CSS files, that's all.

This importer plugin and other PostCSS essentials are wrapped in the getPostCssConfig helper which generates the PostCSS-readable configuration.

At some point, you have to import getPostCssConfig() and pass its output to PostCSS in your bundler, e.g.

const { styles } = require( '@ckeditor/ckeditor5-dev-utils' );

...

somePostCssOptions: styles.getPostCssConfig( {
	themeImporter: {
		themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' )
	},
	minify: true
} )

though I'm not sure what does it look like in parcel. It looks like the configuration is in the .postcssrc.js file. You could use getPostCssConfig() there, I guess.

@ocavue
Copy link
Author

ocavue commented Apr 25, 2018

Thanks for your reply. Your explanations are really helpful.

@ThaddeusJiang
Copy link

ThaddeusJiang commented Jun 28, 2018

@ocavue can you share your solution? Thanks.

@ocavue
Copy link
Author

ocavue commented Jun 28, 2018

@ThaddeusJiang I didn't find out a solution in the end so I switch to webpack. Sorry about that.

I will keep this issue open in case someone figures it out in the future.

@ThaddeusJiang
Copy link

@ocavue Thank you very much.

@ThaddeusJiang
Copy link

ThaddeusJiang commented Jun 29, 2018

@ocavue Hi, brother.
Now, the CKEditor 5 can work in project with parcel .
I created a custom builds.

see: https://github.com/ThaddeusJiang/ckeditor5-build-blueberry

@ocavue
Copy link
Author

ocavue commented Jun 29, 2018

Just did some work. I found out that parcel can't import postcss-import. Both import PI from 'postcss-import' and const PI = 'postcss-import' will cause Uncaught TypeError: Cannot convert undefined or null to object in chrome's console.

I get this error because getPostCssConfig use postcss-import. As what @oleq said, I have to deal with getPostCssConfig. So that's where I have to stop.

Maybe parcel-bundler/parcel#329 is related but I'm not sure.

@pomek pomek removed this from the unknown milestone Feb 21, 2022
@scarletczen
Copy link

Any updates regarding this? Trying to use CKEditor5 with parcel and it throws this error in the css files during the build.
image

@Reinmar
Copy link
Member

Reinmar commented Jan 23, 2024

All those issues will probably be resolved once #15502 hit npm (the project is in progress, all feedback greatly welcomed)

@Witoso
Copy link
Member

Witoso commented Aug 12, 2024

Issure resolved with v42.0.0, but remember that Parcel may need configuration: #16487

@Witoso Witoso closed this as completed Aug 12, 2024
@Witoso Witoso added this to the iteration 75 (v42.0.0) milestone Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

No branches or pull requests

8 participants