F
F
ForSureN12022-04-18 09:42:36
JavaScript
ForSureN1, 2022-04-18 09:42:36

How to include the node_modules Gulp library?

Good afternoon, there was a difficulty, I'm trying to include mapbox in my js file, and I get errors like "Cannot use import statement outside a module",
this is how the connection looks like

import mapboxgl from 'mapbox-gl';
mapboxgl = require('mapbox-gl/dist/mapbox-gl.js')

mapboxgl.accessToken = 'pk.eyJ1IjoiZ3VsYWsxMjMiLCJhIjoiY2wyNDgzbjUyMGluczNncDk1MHlheGNsNiJ9.4nOUSEub8-sL4CUDVdQR-A';
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v11'
});

PS I thought I was making a mistake in the paths, but no, I tried all the options, everything works fine via CDN by the way

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wakenbyWork, 2022-04-18
@wakenbyWork

There is no way in gulp, connect webpack, https://www.npmjs.com/package/webpack-stream

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question