Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

319
Vistas
How to load a .geojson file in TypeScript with webpack?

I need data from a .geojson file. I tried two things:

const geojson = require('../../assets/mygeojson.geojson');

This failed with the following error:

Module parse failed: Unexpected token (2:6) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

My second approach was to use the following:

const geojson = await (await fetch('../../assets/mygeojson.geojson')).json();

This failed with the following error:

Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it) File was processed with these loaders:

  • ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
  • ./node_modules/@ngtools/webpack/src/ivy/index.js

I don't know where exactly to enable those experiments mentioned in the error message.

In any event, all I need is the GeoJSON file as a plain JSON object for further use in my code. Is there perhaps a third approach so simply load a file in TypeScript?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda