Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #334 add esm export #368

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- ** Breaking Change ** removed all code related to `accessToken` and mapbox specific urls, including telemetry etc. Please do not use mapbox servers with this library.
- ** Breaking Change ** removed `baseApiUrl` as it was used only for mapbox related urls
- Added redraw function to map (#206)
- Add module entrypoint for ESM (#334)
Copy link
Collaborator

@HarelM HarelM Sep 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong place, should be one line upwards.

- *...Add new stuff here...*

### 🐞 Bug fixes
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
"version": "2.0.0-pre.4",
"main": "dist/maplibre-gl.js",
"module": "dist/maplibre-gl.module.js",
"style": "dist/maplibre-gl.css",
"license": "BSD-3-Clause",
"repository": {
Expand Down
35 changes: 23 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import banner from './build/banner.js';
const {BUILD, MINIFY} = process.env;
const minified = MINIFY === 'true';
const production = BUILD === 'production';
const outputFile =
!production ? 'dist/maplibre-gl-dev.js' :
minified ? 'dist/maplibre-gl.js' : 'dist/maplibre-gl-unminified.js';
const outputFilePrefix =
!production ? 'dist/maplibre-gl-dev' :
minified ? 'dist/maplibre-gl' : 'dist/maplibre-gl-unminified';

export default [{
// Before rollup you should run build-tsc to transpile from typescript to javascript
Expand All @@ -34,15 +34,26 @@ export default [{
// into a single, final bundle. See rollup/bundle_prelude.js and
// rollup/maplibregl.js for details.
input: 'rollup/maplibregl.js',
output: {
name: 'maplibregl',
file: outputFile,
format: 'umd',
sourcemap: production ? true : 'inline',
indent: false,
intro: fs.readFileSync('./rollup/bundle_prelude.js', 'utf8'),
banner
},
output: [
{
name: 'maplibregl',
file: `${outputFilePrefix}.js`,
format: 'umd',
sourcemap: production ? true : 'inline',
indent: false,
intro: fs.readFileSync('./rollup/bundle_prelude.js', 'utf8'),
banner
},
{
name: 'maplibregl',
file: `${outputFilePrefix}.module.js`,
format: 'esm',
sourcemap: production ? true : 'inline',
indent: false,
intro: fs.readFileSync('./rollup/bundle_prelude.js', 'utf8'),
banner
}
],
treeshake: false,
plugins: [
// Ingest the sourcemaps produced in the first step of the build.
Expand Down