Closed ajmas closed 7 years ago
Hi @ajmas. Thanks for the report. Are you sure you're using the documented instructions for using Mapbox GL JS with other module systems? It looks like the error is not actually coming from mapbox-gl.js.map
(which is a source map file and does not contain the source code referenced in the error message), but from trying to import util.js rather than the distribution build.
Doing some more digging maybe this is more of a user error, but I am not sure of the cause - I can move this to StackExchange if you prefer.
Based on the suggestion you provided I have changed:
const mapboxgl = require('mapbox-gl');
to
const mapboxgl = require('mapbox-gl/dist/mapbox-gl.js');
I now get errors of the form:
{ Error: Cannot find module './lib/geojson_wrapper' from '/Users/ajmas/Development/projects/cvmtl-webui/node_modules/mapbox-gl/dist'
at /Users/ajmas/Development/projects/cvmtl-webui/node_modules/resolve/lib/async.js:55:21
at load (/Users/ajmas/Development/projects/cvmtl-webui/node_modules/resolve/lib/async.js:69:43)
at onex (/Users/ajmas/Development/projects/cvmtl-webui/node_modules/resolve/lib/async.js:92:31)
at /Users/ajmas/Development/projects/cvmtl-webui/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
The odd thing, is that while this fails on the Ubuntu machine, the require('mapbox-gl')
version works on MacOS X 10.12, using node 6.7.0. The require('mapbox-gl/dist/mapbox-gl.js')
format fails on both.
BTW Just seen, while the project does use Gulp, it is using Browserify. I see this in the gulpfile.js:
var bundler = watchify(browserify('./scripts/main.js', { debug: true }).transform(babel, {presets: ["es2015"]}));
Thanks for the clarification! If you are using Browserify, then require('mapbox-gl')
should work. The flow annotations should be removed via the unflowify
transform specified in package.json.
We unfortunately don't have the resources here to debug every build setup, so I have to ask that you continue poking at this yourself.
mapbox-gl version: 0.28.0 (latest version per npm) Operating System: Ubuntu 16.04.1 LTS npm version: 3.5.2 node version: 6.7.0
Failure:
This appears to be coming from mapbox-gl/dist/mapbox-gl.js.map and appears to be typescript related?
Current behaviour: failing build Expected behaviour: it build without error
I have tried removing the ~/web/path-roots/map/ directory, but that doesn't change anything. I also tried the head version of mapbox-gl-js and this caused me other errors of the same type.
The essential part of the package.json of the project: