Mapbox GL JS v2 experiment.
1. About
2. What I Did
2-1. All NPM Packages Installed
2-2. Babel
2-3. Webpack
2-4. Other Build Tools
2-5. Other Dependencies
3. Dev & Build
4. LICENSE
Playing with Mapbox GL JS v2.
Some fancy features:
- No React
- Tailwind
- A bit of Functional Programming
yarn add ramda mapbox-gl
yarn add --dev @babel/core @babel/cli @babel/preset-env core-js@3 @babel/runtime-corejs3 webpack webpack-cli webpack-dev-server babel-loader file-loader css-loader style-loader postcss-loader webpack-merge clean-webpack-plugin html-webpack-plugin copy-webpack-plugin mini-css-extract-plugin license-webpack-plugin postcss autoprefixer tailwindcss prettier http-server
@babel/core
@babel/cli
@babel/preset-env
useBuiltIns: 'usage'
inbabel.config.js
will automatically insert polyfills.
core-js@3
- For
@babel/polyfill
has been deprecated.
- For
@babel/runtime-corejs3
babel-loader
- Always handy having definitions in
.babelrc
(orbabel.config.js
).
- Always handy having definitions in
yarn add --dev @babel/core @babel/preset-env @babel/cli core-js@3 @babel/runtime-corejs3 babel-loader
webpack
webpack-cli
webpack-dev-server
file-loader
css-loader
style-loader
- This is for development only. For production, we are using
mini-css-extract-plugin
.
- This is for development only. For production, we are using
postcss-loader
- We definitely need this when using Tailwind.
yarn add --dev webpack webpack-cli webpack-dev-server file-loader css-loader style-loader postcss-loader
dotenv
- API TOKENS for Mapbox are stored in
.env
and.env.local
. Although they will be included in bundle files anyways, I have IP restrictions for API TOKENS, and no problem.
- API TOKENS for Mapbox are stored in
webpack-merge
clean-webpack-plugin
html-webpack-plugin
- Template is in
src/index.html
, and outputsdist/index.html
.
- Template is in
copy-webpack-plugin
- Just to copy
src/assets
todist/assets
.
- Just to copy
mini-css-extract-plugin
- While we are extracting CSS files, and write them to disks, this is for production only.
license-webpack-plugin
- Extracts license information for production.
postcss
- We definitely need this when using Tailwind.
autoprefixer
prettier
http-server
- May worth nothing. Yet, I can check behaviors for the built bundles before I deploy to the production.
yarn add --dev webpack-merge clean-webpack-plugin html-webpack-plugin license-webpack-plugin postcss autoprefixer prettier http-server
ramda
- Makes our lives easier for functional programming.
tailwindcss
- Since we are not using React this time, we're not using
twin.macro
noremotion
, but a plaintailwind
. See how easy it is to setup. Make sure we havepostcss.config.js
.
- Since we are not using React this time, we're not using
mapbox-gl
- This is our main recipe.
yarn add ramda mapbox-gl
yarn add --dev tailwindcss
yarn start
yarn build
Dual-licensed under either of the followings.
Choose at your option.
- The UNLICENSE (LICENSE.UNLICENSE)
- MIT license (LICENSE.MIT)