-
Notifications
You must be signed in to change notification settings - Fork 85
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
Use ES6 import/export, create bundles with microbundle #41
Conversation
"main": "index.js", | ||
"main": "dist/h3-js.js", | ||
"umd:main": "dist/h3-js.umd.js", | ||
"browser": "dist/h3-js.umd.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one will be replaced by h3-js.browser.js
in a subsequent diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely looking forward to that one. UMD is an abomination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally agreed, but it's useful for standalone use in script
tags, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity how will the "browser" version be different to the UMD version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm putting this diff up shortly - we're actually going to use browser
to remap the CommonJS and ES6 bundles to builds that use the Emscripten browser environment build. This removes the references to fs
and path
that you noted in #21, and should simplify Webpack builds. So browser
will actually be used for browser builds in external rollup tools, rather than for direct use in the browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shall keep an eye out for it and give a quick test with Rollup JS + Webpack when its up...
|
||
NOTE: The current `h3-js` is built with `emscripten-1.37.40`. Earlier or later versions MAY NOT WORK (emscripten does not follow semver, so patch updates may include breaking changes). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you want to remove this warning about emscripten?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's no longer valid (currently using v1.38.29
) and the recommended option is now clearly defined in the scripts, when you run docker boot
.
scripts/update-h3.sh
Outdated
@@ -0,0 +1,25 @@ | |||
#!/usr/bin/env bash | |||
|
|||
# Copyright 2018 Uber Technologies, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should be 2019 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed globally.
"main": "index.js", | ||
"main": "dist/h3-js.js", | ||
"umd:main": "dist/h3-js.umd.js", | ||
"browser": "dist/h3-js.umd.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely looking forward to that one. UMD is an abomination.
cp libh3.js ../../../../out/libh3.js | ||
cat << EOF >> ../../../../out/libh3.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the module hackery anymore!
Modernizes the module imports and the build process, in order to create better bundles for distribution. This is a precursor to a separate PR that will create a browser-only Emscripten build in addition to the current universal build.
require
to ES6import
/export
(should allow tree-shaking for some bundlers)dist
build-emscripten
into two parts, one to update H3 and one to actually buildnyc
for code coverageCloses #21.
TODO: