From e039e829b503148585a5b8cdc57693499d8defb1 Mon Sep 17 00:00:00 2001 From: akirahrkw Date: Fri, 17 Jul 2020 19:42:35 +0800 Subject: [PATCH] As v1.2.0 uses ES6, when you call require method, you need to add .default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before: var MapboxDraw = require('@mapbox/mapbox-gl-draw’); After: var MapboxDraw = require('@mapbox/mapbox-gl-draw').default; --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e12be08..1efe001c 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,16 @@ import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css' **When using modules** +***When using require*** ```js var mapboxgl = require('mapbox-gl'); -var MapboxDraw = require('@mapbox/mapbox-gl-draw'); +// As v1.2.0 uses ES6, you need to add .default +var MapboxDraw = require('@mapbox/mapbox-gl-draw').default; +``` + +***When using import*** +```js +import MapboxDraw from '@mapbox/mapbox-gl-draw' ``` **When using a CDN**