{"record":{"id":"9ff7166231f82961","repo":"laurent22/joplin","slug":"non-css-assets-are-not-supported-by-the-codemirror","errorCode":null,"errorMessage":"Non-css assets are not supported by the CodeMirror 6 editor. (Asset path: ${asset.name})","messagePattern":"Non-css assets are not supported by the CodeMirror 6 editor\\. \\(Asset path: (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/editor/CodeMirror/pluginApi/PluginLoader.ts","lineNumber":169,"sourceCode":"\t\t\tif (loadedPlugin.codeMirrorOptions) {\n\t\t\t\tfor (const key in loadedPlugin.codeMirrorOptions) {\n\t\t\t\t\tthis.editor.setOption(key, loadedPlugin.codeMirrorOptions[key]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (loadedPlugin.assets) {\n\t\t\t\tconst cssStrings = [];\n\n\t\t\t\tfor (const asset of loadedPlugin.assets()) {\n\t\t\t\t\tlet assetText: string = asset.text;\n\t\t\t\t\tlet assetMime: string = asset.mime;\n\n\t\t\t\t\tif (!asset.inline) {\n\t\t\t\t\t\tif (!asset.name) {\n\t\t\t\t\t\t\tthrow new Error('Non-inline asset missing required property \"name\"');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (assetMime !== 'text/css' && !asset.name.endsWith('.css')) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Non-css assets are not supported by the CodeMirror 6 editor. (Asset path: ${asset.name})`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tassetText = await plugin.loadCssAsset(asset.name);\n\t\t\t\t\t\tassetMime = 'text/css';\n\t\t\t\t\t}\n\n\t\t\t\t\tif (assetMime !== 'text/css') {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t'Plugin assets must have property \"mime\" set to \"text/css\" or have a filename ending with \".css\"',\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcssStrings.push(assetText);\n\t\t\t\t}\n\n\t\t\t\taddStyles(cssStrings);","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/editor/CodeMirror/pluginApi/PluginLoader.ts#L151-L187","documentation":"Thrown for a non-inline asset whose name does not end in '.css' and whose mime is not 'text/css'. The CodeMirror 6 editor plugin API only supports CSS assets; non-CSS assets (images, fonts, JS) cannot be injected because the loader only builds <style> elements via addStyles. The asset.name in the message identifies the offending file.","triggerScenarios":"A plugin declares an asset like { name: 'icon.png', mime: 'image/png' }; asset.name is 'theme.js'; the name has no extension and mime is absent/wrong; a CM5 plugin ported with image/font assets that CM6 cannot consume.","commonSituations":"Plugin author bundled an icon or font as a non-inline asset; the asset name was mistyped without the .css extension; the mime field was omitted and name doesn't end with .css.","solutions":["Remove non-CSS assets from the assets() return — embed images/fonts via CSS (data URIs) or bundle them in the plugin's main JS instead.","If the asset is genuinely CSS, rename the file to end in .css or set asset.mime = 'text/css'.","For inline CSS, switch to inline: true with text containing the styles."],"exampleFix":"// before\nassets: () => [{ name: 'theme.json', mime: 'application/json', text: '{}' }],\n// after — only CSS is supported\nassets: () => [{ inline: true, mime: 'text/css', text: '.cm-editor { color: red }' }],","handlingStrategy":"validation","validationCode":"function assertCssAsset(a) {\n  const isCss = a.mime === 'text/css' || (typeof a.name === 'string' && a.name.endsWith('.css'));\n  if (!a.inline && !isCss) throw new Error(`Non-CSS asset not supported: ${a.name}`);\n}\nassets().forEach(assertCssAsset);","typeGuard":"function isCssAsset(a) {\n  return a.mime === 'text/css' || (typeof a.name === 'string' && a.name.endsWith('.css'));\n}","tryCatchPattern":"try {\n  loader.setPlugins(contentScripts);\n} catch (e) {\n  if (/Non-css assets are not supported/.test(e.message)) {\n    // strip the offending asset, notify author\n  } else throw e;\n}","preventionTips":["Declare only CSS assets; bundle images/fonts into JS or data URIs.","End external CSS filenames in .css or set mime: 'text/css'."],"tags":["editor","codemirror","plugin","asset","css"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}