Skip to content

Is there a way to use webglearth2-offline with .js file versus .html? #9

Description

@chertik72

I try to use it in .js component code with react as following:
import React from 'react'
import * as WE from 'webglearth2-offline-gh-pages/v2';

class FlightInfo extends React.Component {

componentDidMount() {
   this.initMap();
}

initMap() {
// Offline tiles
this.map = new WE.map('map');
this.map.setView([46.8011, 8.2266], 2);
WE.tileLayer('{z}/{x}/{y}.jpg', {
tileSize: 256,
bounds: [[-85, -180], [85, 180]],
minZoom: 0,
maxZoom: 16,
attribution: 'WebGLEarth example',
tms: true
}).addTo(this.map);
}

render() {
return(









)

When I am trying to run with CALL npm run dev I am receiving module not found error:

./src/components/flightInfo/FlightInfo.js
Module not found: Can't resolve 'webglearth2-offline-gh-pages/v2' in 'C:\heli-2020\tstWacs3Dbrancht\src\components\flightInfo'

Is there a way to resolve this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions