Closed
Description
What is your research hypothesis/question?
There is a conjunction of 4 features:
- dynamic imports
- top level await
- nodejs module type (es modules in nodejs)
- explicit exports in package.json
That enables some nifty capabilities:
- The ability to create modules that can do feature tests and import the right module for a given platform - cross platform compatibility (especially in terms of platform-native features vs importing specific modules)
- The ability to move away from commonjs modules and use esmodules as a standard for all platforms - this can reduce the dependence on bundling if all platforms support esmodules
- The ability to create explicit package exports, so one can create subdirectory imports
import x from 'a/b/c';
- this can allow us to flexibly export things without having to go down thedist/...
route all the time
These features are all coming online in various forms, however some initial experiments show that they involve alot of changes.
Review existing ideas, literature and prior work
- motivation from nativescript React Native and Mobile OS (iOS and Android) Compatibility Polykey#155 (comment)
- experiment in js-id ID standardisation for all projects and domains js-id#1 (comment)
- ts-node support ESM support: soliciting feedback TypeStrong/ts-node#1007
- Wait for TS 4.5 release
Research conclusion
See the notes in MatrixAI/js-logger#29