Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
H.service no está definido cuando se usa Webpack 5

Estoy tratando de crear un proyecto webpack 5 muy simple en el que sirvo un HTML y trato de cargar un mapa HERE. Es un proyecto mecanografiado.

Mi archivo ts es:

 const main = async () => { const H = await import("@here/maps-api-for-javascript"); console.log(H); //this prints the module object console.log(H.service); //this prints undefined var platform = new H.service.Platform({ apikey: "{YOUR_API_KEY}", }); // Obtain the default map types from the platform object var maptypes = platform.createDefaultLayers(); // Instantiate (and display) a map object: var map = new H.Map( document.getElementById("mapContainer"), maptypes.vector.normal.map, { zoom: 10, center: { lng: 13.4, lat: 52.51 }, } ); }; main();

El error, como puede imaginar, es: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Platform')

Mi tsconfig.json es:

 { "compilerOptions": { "outDir": "./dist/", "sourceMap": true, "noImplicitAny": true, "module": "esnext", "target": "es5", "jsx": "react", "allowJs": true, "moduleResolution": "node" } }

Mi archivo webpack.common.js es:

 const path = require("path"); const TerserPlugin = require("terser-webpack-plugin"); module.exports = { entry: "./src/index.ts", mode: "production", devtool: "source-map", optimization: { usedExports: true, }, output: { filename: "[name].[contenthash].js", path: path.resolve(__dirname, "dist"), }, module: { rules: [ { test: /\.tsx?$/, exclude: /node_modules/, use: { loader: "ts-loader", options: { // disable type checker - we will use it in fork plugin transpileOnly: true, }, }, }, ], }, optimization: { minimizer: [ new TerserPlugin({ exclude: "mapsjs.bundle.js", }), ], }, resolve: { extensions: [".tsx", ".ts", ".js"], }, plugins: [], node: { global: false, }, };

¿Qué me falta para que esto funcione? Gracias

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!