-
Notifications
You must be signed in to change notification settings - Fork 189
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
feat: convert source to pure ESM; remove dependency on parcel v1; fix broken Pool
test
#242
Conversation
I know the PR looks massive, but most of this is due to changing dev dependencies in the
|
Since I created most of the conflicts in #250, I thought I'd take a shot at resolving them. Here is a rebased branch with conflicts fixed: https://github.com/tschaub/geotiff.js/tree/vite With the head of that branch, the tests pass, but it looks like the test runner never exits. I haven't tried debugging this yet. I also found that
Perhaps related. I also haven't dug into this yet. Apologies for the conflicts. Feel free to cherry pick or otherwise make use of any of those commits if that simplifies things. |
It is likely that after #226, the rollup output config will need |
The
geotiff.js
source is written nearly as a pure Node ESM. This means that without any build step, it can run natively in a nodejs.Use full paths for imports
The primary change is to use full file paths for imports
import x from '.'; → import x from './index.js'
, which in turn means that the module can be used via node >12:Additionally an implication of this change means that
mocha
can run without@babel/register
for transpiling the source to commonjs. This means that the test forPool
has been fixed.Replace parcel v1 with Vite
Parcel v1 has been deprecated and Vite is a good modern fit for the development of
geotiff.js
. Starting up the development environment happens instantly with:In addition, I have configured
vite build
to generate the commonjs build target forgeotiff
(dist-node/
). However, in contrast to parcel, I have chosen to avoid bundling the external dependencies since the CJS output is intended to be run in a node environment usingrequire
.Bundle the UMD output with rollup
Vite had some issues bundling the UMD export (can't deal with dynamic imports), so a very minimal rollup config is used to preserve the
dist-browser
target. The Pool still does not work for this export.Add conditional exports to
package.json
These exports are conditionally understood in nodejs and will allow goetiff to be imported or required depending on the runtime environment. So both of these will work natively in Nodejs.