zhenyanghua/MeasureTool-GoogleMaps-V3

Importing to Project

Closed this issue · 4 comments

When you try to implement this library to your project, you can add with npm install or yarn add without a problem.

But when you try to create an instance for measure tool like below.

this.measureTool = new MeasureTool(map, {
   showSegmentLength: true,
   tooltip: true,
   unit: MeasureTool.UnitTypeId.METRIC, // metric or imperial
});

You need to import js file like that.

import MeasureTool from '../lib/MeasureTool';

Is there a way just use node_modules automatically ?

It supports global and ESM import. I’m not sure what “automatically” mean here, do you mind clarifying it?

Of course. I downloaded your library with yarn add in my Vue project. But when I create MeasureTool instance in my page also I need to import MeasureTool.js file.

I was thinking maybe is there a way without import that js file?

Why not doing this: import MeasureTool from “measuretool-googlemaps-v3”?

Sorry. I got it right now. It was a silly mistake I think. Thanks for your help.