我想在NodeJS服务器上着色一些代码。
这是我的NodeJS代码:
import monaco from 'monaco-editor';
monaco.editor.colorize(
"function hello() {\n\talert('Hello world!');\n}",
"javascript",
{}
)
.then(html => console.log(html));
但是我得到这个错误:
Rollup: Parse Error
Unexpected token (Note that you need plugins to import files that are not JavaScript)
node_modules/monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.css
| 4: *--------------------------------------------------------------------------------------------*/
| 5:
| 6: .monaco-editor .accessibilityHelpWidget {
| ^
| 7: padding: 10px;
| 8: vertical-align: middle;
您知道我应该修改什么以使服务器端的代码着色吗?