ajaxorg/ace · warning
script for emmet-core is not loaded
Error message
script for emmet-core is not loaded
What it means
config.warn('script for emmet-core is not loaded') is emitted by ext/emmet's load() when the emmetPath internal variable is not a string, meaning the emmet-core script was never loaded or the load chain was already consumed. The function then returns false and the callback never fires, so Emmet expansion will not work.
Solutions
- Load emmet-core before calling load — include emmet-core.js from the emmet distribution before ext/emmet
- Only call emmet.load() once; subsequent calls return false because emmetPath is nulled after the first load
- Use config.loadModule('ace/ext/emmet', ...) so the extension loads with its dependencies in the correct order
- Check the return value of load(); false means emmet-core wasn't wired up — re-check script order
Example fix
// before
ace.require('ace/ext/emmet').load(function() {...}); // emmet-core never loaded
// after
// include emmet-core.js first, then:
ace.require('ace/ext/emmet').load(function() { editor.setOption('emmet', true); }); Defensive patterns
Strategy: fallback
Validate before calling
var emmet = ace.require('ace/ext/emmet');
if (emmet.load() === false) {
console.warn('emmet-core missing; emmet disabled');
} else {
editor.setOption('emmet', true);
} Type guard
function emmetAvailable(emmetExt) { return emmetExt && emmetExt.load() !== false; } Try / catch
try {
var ok = ace.require('ace/ext/emmet').load(function() { editor.setOption('emmet', true); });
if (!ok) console.warn('emmet-core script not loaded; skipping emmet setup');
} catch (e) {
console.warn('emmet unavailable', e);
} Prevention
- Always include emmet-core.js before ext/emmet.js
- Call emmet.load() exactly once; it nulls emmetPath after the first load
- Check the boolean return of load() before enabling the emmet option
- Use ace.config.loadModule('ace/ext/emmet', ...) to get correct load ordering
When it happens
Trigger: Calling exports.load(cb) (e.g., via ace.require('ace/ext/emmet').load(cb)) without first loading the emmet-core script, or calling load() a second time after emmetPath was reset to null by a previous load.
Common situations: Enabling the emmet extension without adding emmet-core.js to the page; double-invoking load(); bundler setups where the emmet-core dependency isn't wired into the emmet extension.
Related errors
AI-assisted analysis of ajaxorg/ace@2c1eddc392 (2026-08-30).
Data as JSON: /api/errors/a644aefb5a97e131.
Report an issue: GitHub.
Appendix: source
Thrown at src/ext/emmet.js:457
if (!editor)
return;
var enabled = exports.isSupportedMode(editor.session.$mode);
if (e.enableEmmet === false)
enabled = false;
if (enabled)
exports.load();
exports.updateCommands(editor, enabled);
};
/**
* Loads the Emmet core module dynamically.
*
* @param {Function} [cb] - Optional callback function to be executed after module loading
* @return {boolean} Whether the Emmet core module loading was initiated successfully
*/
exports.load = function(cb) {
if (typeof emmetPath !== "string") {
config.warn("script for emmet-core is not loaded");
return false;
}
config.loadModule(emmetPath, function() {
emmetPath = null;
cb && cb();
});
return true;
};
exports.AceEmmetEditor = AceEmmetEditor;
config.defineOptions(Editor.prototype, "editor", {
enableEmmet: {
set: function(val) {
this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
onChangeMode({enableEmmet: !!val}, this);
},
value: true
}View on GitHub (pinned to 2c1eddc392)