maptalks / maptalks.mapboxgl

MapboxglLayer for maptalks.js
MIT License
57 stars 23 forks source link

ES6 Import #7

Closed jakob-fuchs closed 6 years ago

jakob-fuchs commented 6 years ago

I'm trying to import the MapboxGL plugin the following way:

  import * as MapTalks from 'maptalks/dist/maptalks';
  import 'maptalks/dist/maptalks.css';
  import { MapboxglLayer } from 'maptalks.mapboxgl';

Getting the following error message:

./node_modules/maptalks.mapboxgl/dist/maptalks.mapboxgl.es.js Module not found: Error: Can't resolve 'mapboxgl' in '/home/xxx/xxx/xxx/app/node_modules/maptalks.mapboxgl/dist'

Any ideas why that is not working?

jakob-fuchs commented 6 years ago

It seems like the MapboxGL package is called mapbox-gl now. Updating the import here seems fix the problem: https://github.com/maptalks/maptalks.mapboxgl/blob/f207a4576eb94bcd5091a70574d929fb82ef9044/dist/maptalks.mapboxgl.es.js#L10

fuzhenn commented 6 years ago

Great! Do you mind submitting a PR?

davidweining2333 commented 5 years ago

@jakob-fuchs

Failed to compile.

./node_modules/_maptalks.mapboxgl@0.3.3@maptalks.mapboxgl/dist/maptalks.mapboxgl.es.js Module not found: Can't resolve 'mapbox-gl' in 'D:\w-code\neweconomy\nc\node_modules_maptalks.mapbo xgl@0.3.3@maptalks.mapboxgl\dist'

did your resolved this ? i have this error when i

import {MapboxglLayer} from "maptalks.mapboxgl";