{"record":{"id":"a644aefb5a97e131","repo":"ajaxorg/ace","slug":"script-for-emmet-core-is-not-loaded","errorCode":null,"errorMessage":"script for emmet-core is not loaded","messagePattern":"script for emmet-core is not loaded","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/ext/emmet.js","lineNumber":457,"sourceCode":"    if (!editor)\n        return;\n    var enabled = exports.isSupportedMode(editor.session.$mode);\n    if (e.enableEmmet === false)\n        enabled = false;\n    if (enabled)\n        exports.load();\n    exports.updateCommands(editor, enabled);\n};\n\n/**\n * Loads the Emmet core module dynamically.\n *\n * @param {Function} [cb] - Optional callback function to be executed after module loading\n * @return {boolean} Whether the Emmet core module loading was initiated successfully\n */\nexports.load = function(cb) {\n    if (typeof emmetPath !== \"string\") {\n        config.warn(\"script for emmet-core is not loaded\");\n        return false;\n    }\n    config.loadModule(emmetPath, function() {\n        emmetPath = null;\n        cb && cb();\n    });\n    return true;\n};\n\nexports.AceEmmetEditor = AceEmmetEditor;\nconfig.defineOptions(Editor.prototype, \"editor\", {\n    enableEmmet: {\n        set: function(val) {\n            this[val ? \"on\" : \"removeListener\"](\"changeMode\", onChangeMode);\n            onChangeMode({enableEmmet: !!val}, this);\n        },\n        value: true\n    }","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/ajaxorg/ace/blob/2c1eddc392eb92cf222a4478f1893d2b2c354fb0/src/ext/emmet.js#L439-L475","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nace.require('ace/ext/emmet').load(function() {...}); // emmet-core never loaded\n// after\n// include emmet-core.js first, then:\nace.require('ace/ext/emmet').load(function() { editor.setOption('emmet', true); });","handlingStrategy":"fallback","validationCode":"var emmet = ace.require('ace/ext/emmet');\nif (emmet.load() === false) {\n  console.warn('emmet-core missing; emmet disabled');\n} else {\n  editor.setOption('emmet', true);\n}","typeGuard":"function emmetAvailable(emmetExt) { return emmetExt && emmetExt.load() !== false; }","tryCatchPattern":"try {\n  var ok = ace.require('ace/ext/emmet').load(function() { editor.setOption('emmet', true); });\n  if (!ok) console.warn('emmet-core script not loaded; skipping emmet setup');\n} catch (e) {\n  console.warn('emmet unavailable', e);\n}","preventionTips":["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"],"tags":["emmet","extension","dependency-loading","configuration"],"backgroundTag":"dependency-script-not-loaded","analyzedSha":"2c1eddc392eb92cf222a4478f1893d2b2c354fb0","analyzedAt":"2026-08-30T00:39:52.222Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}