angularckeditor5esbuild

Angular esbuild ckeditor. No loader is configured for ".svg"


I use ckEditor. If I import a ckEditor plugin, I get this error

No loader is configured for ".svg" files: node_modules/@ckeditor/ckeditor5-core/theme/icons/table.svg

My versions:

Angular version: 17.1.2
@ckeditor/ckeditor5-angular: 7.0.1
@ckeditor/ckeditor5-build-classic: 41.0.0
import { Autoformat } from '@ckeditor/ckeditor5-autoformat'
export const CK_EDITOR_DEFAULT_CONFIG = {
   plugins: [
     // Essentials,
     // UploadAdapter,
     Autoformat,
   ]
}

Does Angular with esbuild support a custom loader? Or are there any other solutions to support svg loader?

I added d.ts to src, but it doesn't help:

declare module '*.svg' {
   const content: string
   export default content
}

Solution

  • Simplifying File Imports in Angular with New Loader Options

    In angular.json from version 17.1.0, we can add loaders in config:

    "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:application",
          "options": {
            ...
            "loader": {
              ".svg": "text"
            },