-
Notifications
You must be signed in to change notification settings - Fork 364
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
CJS to ESM #7311
base: main
Are you sure you want to change the base?
CJS to ESM #7311
Conversation
These are files from TerriaJS V7 not referenced anywhere else. Some of these might be useful if we want to port them to v8 in the future. If that's the case please refer to https://github.com/terriajs/terriajs/tree/terriajs7
This requires, in some places: - simply swapping require with import - creating a stub .d.ts module definition in lib/ThirdParty - updating the library to get new bundled type definitions - file-saver - react-responsive - or adding @types/x as dependency - @types/proj4 Remaining require() imports are all for static assets or web workers which can be fixed when upgrading to webpack 5.
It is redundant when using typescript.
@@ -113,7 +113,7 @@ | |||
"dompurify": "^2.3.3", | |||
"fetch-mock": "^9.11.0", | |||
"file-loader": "^3.0.1", | |||
"file-saver": "^1.3.8", | |||
"file-saver": "^2.0.4", |
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.
There is a file-saver 2.0.5 released 4 years ago, is there a reason to not bump to that version?
@@ -195,6 +195,7 @@ | |||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | |||
"@types/dateformat": "^3.0.1", | |||
"@types/node": "^18.15.11", | |||
"@types/proj4": "^2.5.5", |
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.
My understanding is that the type annotations are required by tsc, so without them yarn gulp release
will fail. Does yarn gulp release
work for an external repository, like TerriaMap, if @types/proj4
is a devDependency here?
What this PR does
Convert CJS modules to ESM.
Required for #6998
Depends on: https://github.com/terriajs/terriamap/tree/cjs-to-esm
TODO:
What this PR does:
Removes stale CJS files that are no longer used (395d3b9)
Convert CJS style
module.exports
to ESM styleexport default ...
(7129b24)Convert CJS require() to ESM import statements. (30654f1)
This requires, in some places:
file-saver
react-responsive
@types/proj4
Remaining require() imports are all for static assets or web workers which can be fixed when upgrading to webpack 5.
Remove
use strict
declaration for.tsx?
files.Test me
Test http://ci.terria.io/cjs-to-esm
Checklist
doc/
.