glacambre / editor-adapter

A library to interact with in-browser JS editors like Ace, CodeMirror or Monaco
MIT License
5 stars 3 forks source link

Add CodeMirror6Editor #8

Closed meatballs closed 2 years ago

meatballs commented 2 years ago

First attempt at #6

meatballs commented 2 years ago

I get an error when trying to build:

[webpack-cli] Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at BulkUpdateDecorator.hashFactory (/home/owen/projects/personal/firenvim/node_modules/webpack/lib/util/createHash.js:155:18)
    at BulkUpdateDecorator.digest (/home/owen/projects/personal/firenvim/node_modules/webpack/lib/util/createHash.js:80:21)
    at /home/owen/projects/personal/firenvim/node_modules/webpack/lib/DefinePlugin.js:595:38
    at _next27 (eval at create (/home/owen/projects/personal/firenvim/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:44:1)
    at _next5 (eval at create (/home/owen/projects/personal/firenvim/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1)
    at Hook.eval [as call] (eval at create (/home/owen/projects/personal/firenvim/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:111:1)
    at Hook.CALL_DELEGATE [as _call] (/home/owen/projects/personal/firenvim/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/home/owen/projects/personal/firenvim/node_modules/webpack/lib/Compiler.js:1053:26) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

This is using npm 8.19.2 on Ubuntu 22.04

Building with docker works fine.

meatballs commented 2 years ago

build issue fixed with NODE_OPTIONS as per this SO question: https://stackoverflow.com/questions/69394632/webpack-build-failing-with-err-ossl-evp-unsupported

meatballs commented 2 years ago

and it's working fine for me - vivaldi browser, in case that makes any difference

glacambre commented 2 years ago

Oh, indeed, it does seem to work in chrome-based browser, it's only Firefox that doesn't work :thinking: .

glacambre commented 2 years ago

You did the work to get CodeMirror6 to work for your usecase, I won't force you to make it work for other people. I've added a commit that makes CodeMirror6 optional and will make Firenvim enable it when running in Chrome.

Thanks again for your contribution! :)

meatballs commented 2 years ago

Thank you! That gets my workflow back how I like it!

I have an idea for getting the language out of codemirror 6. I'll try it out today and submit a PR if it works out.