simple-code-editor
simple-code-editor copied to clipboard
Import error
Hi,
i have this error using this package:
SyntaxError: The requested module '/node_modules/highlight.js/lib/index.js?v=a76deadf' does not provide an export named 'default' (at index.js?v=a76deadf:2:8)
I use vite.
I have currently removed lang = "ts" from my script (I saw it doesn't support it).
I imported the component in a simple way:
import CodeEditor from 'simple-code-editor'
I am getting the same error (also using Vite with TypeScript)
I've solved this by installing highlight.js:
npm install highlight.js and importing hljs
import hljs from "highlight.js";
import CodeEditor from 'simple-code-editor'
Also using Vite
@cooljet84 - can't get it working as per your suggestion. also using vite
I've solved this by installing highlight.js:
npm install highlight.js and importing hljs
import hljs from "highlight.js"; import CodeEditor from 'simple-code-editor'
Also using Vite
Thank You! It is working perfectly.
Instead of importing hightlight.js
everywhere and potentially getting eslint's unused vars warning. We can add this to vite.config.js
file:
// ...
optimizeDeps: {
include: ['highlight.js']
}