From 26cded30c9680985e601089d54ca8d6ac99d07c3 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Wed, 21 Sep 2016 15:34:07 +0300 Subject: [PATCH 1/3] remove support for building mapbox-gl with webpack --- README.md | 13 +++---------- package.json | 6 ++---- test/build/webpack.test.js | 27 --------------------------- test/fixtures/webpack-entry.js | 5 ----- 4 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 test/build/webpack.test.js delete mode 100644 test/fixtures/webpack-entry.js diff --git a/README.md b/README.md index 976758180b7..ea7b1171b7e 100644 --- a/README.md +++ b/README.md @@ -64,23 +64,16 @@ var map = new mapboxgl.Map({ To use the [vector tiles](https://www.mapbox.com/maps/) and styles hosted on http://mapbox.com, you must [create an account](https://www.mapbox.com/studio/signup/) and then [obtain an access token](https://www.mapbox.com/studio/account/tokens/). You may learn more about access tokens [here](https://www.mapbox.com/help/define-access-token/). -Install the [`mapbox-gl` npm package](https://www.npmjs.com/package/mapbox-gl) -and the required loaders. +Install the [`mapbox-gl` npm package](https://www.npmjs.com/package/mapbox-gl): ```bash npm install --save mapbox-gl -npm install --save transform-loader -npm install --save json-loader -npm install --save webworkify-webpack ``` -Add the [required additional options from webpack.config.example.js](webpack.config.example.js) -to your webpack configuration. - -Instantiate `mapboxgl.Map` +Require the distribution build of mapbox-gl and instantiate `mapboxgl.Map`: ```js -var mapboxgl = require('mapbox-gl'); +var mapboxgl = require('mapbox-gl/dist/mapbox-gl.js'); mapboxgl.accessToken = ''; var map = new mapboxgl.Map({ container: '', diff --git a/package.json b/package.json index 27af94908c1..a0bc62fa976 100644 --- a/package.json +++ b/package.json @@ -75,9 +75,7 @@ "unist-util-visit": "1.1.0", "vinyl": "1.1.1", "vinyl-fs": "2.4.3", - "watchify": "^3.7.0", - "webpack": "^1.13.1", - "webworkify-webpack": "^1.1.3" + "watchify": "^3.7.0" }, "browserify": { "transform": [ @@ -108,7 +106,7 @@ "open-changed-examples": "git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open", "test": "run-s lint test-unit", "test-suite": "run-s test-render test-query", - "test-unit": "tap --reporter dot --no-coverage test/js test/build/webpack.test.js", + "test-unit": "tap --reporter dot --no-coverage test/js", "test-render": "node test/render.test.js", "test-query": "node test/query.test.js", "test-cov": "nyc --reporter=text-summary --cache run-s test-unit test-render test-query" diff --git a/test/build/webpack.test.js b/test/build/webpack.test.js deleted file mode 100644 index 53a03b09b55..00000000000 --- a/test/build/webpack.test.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -var webpack = require("webpack"); -var test = require('tap').test; -var MemoryFS = require('memory-fs'); -var util = require('../../js/util/util'); - -test('builds with webpack', function(t) { - - var compiler = webpack(util.extend(require('../../webpack.config.example'), { - entry: './test/fixtures/webpack-entry.js', - output: { - path: '/', - filename: 'webpack.js' - } - })); - - compiler.outputFileSystem = new MemoryFS(); - compiler.run(function(error, stats) { - t.error(error); - t.notOk(stats.hasErrors()); - t.notOk(stats.hasWarnings()); - t.ok(compiler.outputFileSystem.readFileSync('/webpack.js').toString()); - t.end(); - }); - -}); diff --git a/test/fixtures/webpack-entry.js b/test/fixtures/webpack-entry.js deleted file mode 100644 index 566241d398e..00000000000 --- a/test/fixtures/webpack-entry.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -// Script for testing a webpack build that requires mapbox-gl - -require('../../js/mapbox-gl'); From 95be0252c7f3e98f6c2894dd3b2b86964bac6896 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Wed, 21 Sep 2016 16:12:50 +0300 Subject: [PATCH 2/3] clarify usage of mapbox-gl with other module bundlers --- README.md | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index ea7b1171b7e..d7065970d30 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,12 @@ It is part of the [Mapbox GL ecosystem](https://github.com/mapbox/mapbox-gl) whi [Mapbox GL JS gallery](https://www.mapbox.com/gallery/) -## Using Mapbox GL JS with a `