我能够在ace- themePath中运行(我使用的是nom ace-builds包)。我可以设置基本路径,编辑器可以正常加载,但是它仍然在缺省目录中查找主题。
import ace
import ace from 'ace-builds'
import {Range, EditSession} from 'ace-builds'
// import modes that you want to include into your main bundle
import "ace-builds/src-noconflict/mode-yaml";
// import webpack resolver to dynamically load modes,
you need to install file-loader for this to work!
import "ace-builds/webpack-resolver";
ace.config.set("themePath","../static/js");
ace.config.set("basePath","../static/js");
ace.config.set("modePath","../static/js");
var editor = ace.edit("ace_editor_playbook", {
maxLines: 25,
minLines: 25,
value: "---" + "\n",
mode: "ace/mode/yaml",
theme: "ace/theme/vibrant_ink",
bug: 1
})谢谢。
发布于 2019-02-22 03:30:10
不使用themePath,因为https://github.com/ajaxorg/ace-builds/blob/master/webpack-resolver.js明确地设置了所有主题的路径。如果您想使用themePath,请不要加载webpack解析器
https://stackoverflow.com/questions/54799156
复制相似问题