Mapbox-gl-js: This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.

Created on 15 Jun 2016  路  6Comments  路  Source: mapbox/mapbox-gl-js

I added this to webpack.config.js

resolve: {
        root: path.join(__dirname, '..', 'app'),
        alias: {
            'react': path.join(__dirname, 'node_modules', 'react'),
            'mapbox-gl': path.resolve('./node_modules/mapbox-gl/js/mapbox-gl.js'),
            'webworkify': 'webworkify-webpack'
        },
        extensions: ['', '.js', '.jsx', '.json', '.css', '.styl', '.png', '.jpg', '.jpeg', '.gif']
    },

I f I don't put that, the map won't come out. And when I put it up, I hit the abovemention warning. Please advise

Most helpful comment

@chafnan, @infacq, add the following to your webpack config to get rid of the warning:

...
module: {
    noParse: /node_modules\/mapbox-gl\/dist\/mapbox-gl.js/,
    loaders: [{
    ...
    }]
}
...

All 6 comments

Hello @infacq! Thanks for writing in! Have you followed all the steps in our webpack setup instructions? https://github.com/mapbox/mapbox-gl-js#using-mapbox-gl-js-with-webpack

@tmcw do you have any insight here?

yes. everything is installed and the only hack I did is

'mapbox-gl': path.resolve('./node_modules/mapbox-gl/dist/mapbox-gl.js'),

because I was following this post to get fix of mapboxGL

That blog post is outdated; please try the webpack config @lucaswoj linked above.

that's true @jfirebaugh. Now I just follow the recommended way by official mapbox README. But still hit this warning

I'm having this same issue, and the package is being required as the webpack setup is directing from the link above. Is there any other suggestions on how to remove this warning?

@chafnan, @infacq, add the following to your webpack config to get rid of the warning:

...
module: {
    noParse: /node_modules\/mapbox-gl\/dist\/mapbox-gl.js/,
    loaders: [{
    ...
    }]
}
...
Was this page helpful?
0 / 5 - 0 ratings