azure-appserviceazure-webapps

How to Deploy Openlayer app to azure app service windows via vs code?


I'm very new to azure,when i deploying simple openlayer app to azure i am facing below issue

 Uncaught TypeError: Failed to resolve module specifier "ol/Map.js". Relative references must start with either "/", "./", or "../".

main.js

import Map from 'ol/Map.js';
import OSM from 'ol/source/OSM.js';
import TileLayer from 'ol/layer/Tile.js';
import View from 'ol/View.js';

const map = new Map({
  layers: [
    new TileLayer({
      source: new OSM(),
    }),
  ],
  target: 'map',
  view: new View({
    center: [0, 0],
    zoom: 2,
  }),
});

Solution

  • I created simple OpenLayer Application by following OpenLayer documentation and deployed it to Azure App service Windows using Vs Code.

    Uncaught TypeError: Failed to resolve module specifier "ol/Map.js". Relative references must start with either "/", "./", or "../".

    Even I got the same Issue, to resolve the issue I ran below command to generate Production ready file (dist) and deploy the dist folder to Azure Web App.

    npm run build
    

    enter image description here

    Azure Output:

    enter image description here