I'm using ace editor in a project. I'm trying to create a HightLight, following the tutorial in Higlighter section on ace editor page, but when I use this code:
define(function(require,exports,module){
//any code here
});
I get this error in the web console:
dropping module because define wasn't a string.
Does anyone know why it happens?
I'm using ace editor in a project. I'm trying to create a HightLight, following the tutorial in Higlighter section on ace editor page, but when I use this code:
define(function(require,exports,module){
//any code here
});
I get this error in the web console:
dropping module because define wasn't a string.
Does anyone know why it happens?
Share Improve this question edited May 14, 2016 at 15:12 Paul Roub 36.5k27 gold badges86 silver badges95 bronze badges asked May 13, 2016 at 16:38 jircdeveloperjircdeveloper 4344 silver badges19 bronze badges 1- I also had this happen, but in my case, it was due to usage of incorrect js libs for ace, which caused an issue with the define function, as specified in the answer. – Avrdan Commented Jul 12, 2018 at 11:45
1 Answer
Reset to default 10Ace defines a global function called define
, and that function is what is producing the error.
If you have any other JS libraries (particularly CommonJS or AMD modules) that call define
, they will end up calling the Ace version if Ace is loaded before they are.
In my case, I had a JS file produced by Browserify that included a bunch of Node modules, and one of those was calling define
with an empty array instead of a string for the module
param. And because it was included after the Ace script file, it was using the Ace version of define
, which plained with the error message in question.
Changing the order of your script includes may fix this (move your other module-based script includes above the Ace script include). That worked for me.