Ckeditor5: Can CKEditor 5's source code be loaded using @std/esm?

Created on 12 Oct 2017  路  3Comments  路  Source: ckeditor/ckeditor5

https://codeburst.io/the-javascript-modules-limbo-585eedbb182e

A possible pattern to move forward

Forget about .mjs, keep .js and code happily ever after via @std/esm configuring it via package.json as such:

"@std/esm": {"esm": "js"}

or simply

"@std/esm": "js"

Once you鈥檝e done that, everything problematic mentioned in this post will disappear. You now rename both index.mjs and module.mjs files into index.js and module.js and launch your program like this:

node -r @std/esm index.js

At this point you have .js extensions that will work with every one-off server side spinner you have, you can finally import test from "./module.js"; specifying the entire file name and that will work out of the box in browsers, JSC, SpiderMonkey, and whatever other environment you want.

I wonder if the Node-compatible parts of CKEditor 5 (e.g. the engine's model or utils) can be loaded in Node.js without any transpilation.

cc @czerwonkabartosz, did you try this?

question

Most helpful comment

All 3 comments

Ooo I'll try this!

So cool!

Was this page helpful?
0 / 5 - 0 ratings