Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
instantgis opened this issue Dec 22, 2024 · 1 comment

Comments

@instantgis
Copy link

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"
            }
          }
@oterral
Copy link
Contributor

oterral commented Jan 3, 2025

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

It seems an angular problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants