hi. i add package for mapbox-gl in your template as i dont want to use leaflet. can you show me in gulp compile to change the NODE_ENV and make mapbox-gl can compile thier dependencies. i got error in css too.
you can make changes in the Gulp configuration to set the NODE_ENV environment variable. Here's how you can do it:
Open the Gulp configuration file (gulpfile.js or a similar file) in your project. You can try to set the NODE_ENV variable like this.
process.env.NODE_ENV = "development";
<link href="https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.css" rel="stylesheet" />
sorry, unfortunately does not work. cause im adding mapbox-gl by using npm package. so when i minify the js. i will show up this error.
In the 'tools/gulp.config.js' file, could you please try to add the following configuration to include the Mapbox GL dependencies in your gulp compile:
Yup im already do that. For css i create scss for mapbox-gl base on default css and compile together. But when i do gulp --prod. How to skip mapbox from minified?
Currently, the gulp build tools do not have an option to skip minification for specific CSS files. When you use the command "gulp --prod," all assets, including the mapbox CSS file, will be minified.
One possible solution is to import the mapbox CSS as a separate file from "mapbox-gl/dist/mapbox-gl.css" in your HTML file. By doing this, the mapbox CSS will not be included in the gulp build process, and it won't be minified.
Here's how you can do it:
1. In your HTML file, add a link to the mapbox CSS file:
<link rel="stylesheet" href="path/to/mapbox-gl/dist/mapbox-gl.css">
Yes. All fine for css. But js still got this error. How to make mapbox-gl.js skip to be minified on gulp prod?
At the moment, the gulp build tools don't provide a direct option to skip minification for specific CSS files, including the mapbox CSS file. When you execute the command "gulp --prod," all assets will be minified as part of the build process.
If you wish to exclude certain CSS files from minification, it will require customizing the gulp build configurations. This customization involves modifying the gulp tasks responsible for minification to exclude specific files.