openlayers-editor icon indicating copy to clipboard operation
openlayers-editor copied to clipboard

No loader is configured for ".svg" files: node_modules/ole/img/buffer.svg

Open instantgis opened this issue 11 months ago • 1 comments

I am trying to use this openlayers-editor in a simple Angular 19 web app and I am getting...

I strarted with a boilerplate Angular 19 in Stackblitz to which I added

"ol": "^10.3.1",
"ole": "^2.4.5",

My code is then...

import { Component, OnInit } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import Map from "ol/Map";
import View from "ol/View";
import TileLayer from 'ol/layer/Tile';
import Vector from 'ol/layer/Vector';
import OSM from 'ol/source/OSM';
import { Vector as VectorSource } from 'ol/source';
import { Editor, control } from 'ole';

@Component({
  selector: 'app-root',
  template: `
<div id="map" class="map"></div>
  `,
})
export class App implements OnInit {
  private streetLayer = new TileLayer({
    source: new OSM()
  });
  map!: Map;
  editLayer: any;
  editor!: Editor;
  ngOnInit() {
    this.editLayer = new Vector({
      source: new VectorSource({
        wrapX: false,
      }),
    });
    this.map = new Map({
      target: "map",
      view: new View({
        center: [0, 0],
        zoom: 2,
      }),
      controls: [],
      layers: [this.editLayer],
    });
    this.map.addLayer(this.streetLayer);
    this.editor = new Editor(this.map, { showToolbar: true});
    var draw = new control.Draw();
    this.editor.addControl(draw);
  }
}

bootstrapApplication(App);

I am getting...

No loader is configured for ".svg" files: node_modules/ole/img/buffer.svg node_modules/ole/build/control/buffer.js:7:22

in angular.json I tried...

https://stackoverflow.com/questions/77930365/angular-esbuild-ckeditor-no-loader-is-configured-for-svg

loader ".svg": binary empty file text, none of these work

          "options": {
            "assets": [],
            "index": "src/index.html",
            "browser": "src/main.ts",
            "outputPath": "dist/demo",
            "polyfills": ["zone.js"],
            "scripts": [],
            "styles": ["src/global_styles.scss"],
            "tsConfig": "tsconfig.app.json",
            "loader": {
              ".svg": "text"
            }
          }

instantgis avatar Dec 22 '24 20:12 instantgis

@instantgis Are you able to provide us a code pen or codesandbox example ?

It seems an angular problem.

oterral avatar Jan 03 '25 07:01 oterral