【发布时间】:2021-04-13 09:38:21
【问题描述】:
我正在使用react-ace 并尝试使用 java 语法的自述文件示例。效果很好。但我似乎无法将其设置为 JSON。
Java 工作
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-java";
import "ace-builds/src-noconflict/theme-github";
<AceEditor
mode="java"
theme="github"
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
/>
JSON 不起作用?
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-json";
import "ace-builds/src-noconflict/theme-github";
<AceEditor
mode="json"
theme="github"
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
/>
错误
拒绝从 '...../worker-json.js' 执行脚本,因为它的 MIME 类型 ('text/html') 不可执行。 (匿名)@ 2f896707-86be-497a-93b2-e1711942d7c7:1 2f896707-86be-497a-93b2-e1711942d7c7:1 未捕获的 DOMException:无法在“WorkerGlobalScope”上执行“importScripts”:“...../worker-json.js”处的脚本无法加载。
如何使用 JSON?
【问题讨论】:
-
你有最小的可重现回购吗?
标签: javascript reactjs laravel react-ace