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

Can CKEditor 5's source code be loaded using @std/esm? #601

Closed
Reinmar opened this issue Oct 12, 2017 · 3 comments
Closed

Can CKEditor 5's source code be loaded using @std/esm? #601

Reinmar opened this issue Oct 12, 2017 · 3 comments
Labels
type:question This issue asks a question (how to...).

Comments

@Reinmar
Copy link
Member

Reinmar commented Oct 12, 2017

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’ve 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?

@Reinmar Reinmar added the type:question This issue asks a question (how to...). label Oct 12, 2017
@czerwonkabartosz
Copy link

Ooo I'll try this!

@czerwonkabartosz
Copy link

It looks like it works - https://github.com/czerwonkabartosz/std-esm-test/blob/master/index.js

@jdalton
Copy link

jdalton commented Nov 17, 2017

So cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

3 participants