|
| 1 | +# What is a Minimal Kernel for ESM in Node.js? |
| 2 | + |
| 3 | +A minimal kernel is a subset of features that the @nodejs/modules group have agreed will be necessary for all potential iterations of our ESM implementation. It strips out any features that preclude other features |
| 4 | + |
| 5 | +# Why build a Minimal Kernel? |
| 6 | + |
| 7 | +Having a minimal kernel creates a subset that we can build consensus on top of. It will also allow sharing features across proposals that potentially have different end goals and feature sets. Finally, reaching consensus on a minimal kernel is a win for the team, showing that we do indeed have a layer of consensus even if it is not entirely clear. |
| 8 | + |
| 9 | +# What is our minimal kernel |
| 10 | + |
| 11 | +* both browser + node need bare imports |
| 12 | + - implementation to be discussed |
| 13 | +* we cannot have dynamic path searching |
| 14 | + - requiring the full path is an issue for tooling and a long term solution is required |
| 15 | + - migration strategies also have issue with this |
| 16 | +* common.js backwards compat |
| 17 | + - createRequireFunction does |
| 18 | + - import.meta.require does not fail early enough |
| 19 | + - hold off on importing common.js until more progress is made on dynamic modules spec |
| 20 | +* .mjs will be the only way to import ESM |
| 21 | + - intention is to move forward with format databases to map extensions and support multiple use cases |
| 22 | +* only supporting importing ESM |
| 23 | + - no JSON |
| 24 | + - no native modules |
| 25 | + - createRequireFunction used to get these |
| 26 | + - will come back with format database |
| 27 | +* import.meta.url |
| 28 | +* dynamic import |
| 29 | + |
| 30 | +# How will we get from where we are to the minimal kernel |
| 31 | + |
| 32 | +* removing importing of formats other than ESM |
| 33 | + - no common.js |
| 34 | + - no JSON |
| 35 | + - no native modules |
| 36 | + - implemented in https://github.com/nodejs/ecmascript-modules/pull/3 |
| 37 | +* removing of dynamic path searching |
| 38 | + - no extension adding |
| 39 | + - no directory resolution |
| 40 | + - no support for index.js |
| 41 | + - still maintaining support for the main field |
| 42 | + - implemented in https://github.com/nodejs/ecmascript-modules/pull/2 |
| 43 | +* adding createRequireFunction |
| 44 | + - implemented in https://github.com/nodejs/node/pull/19360 |
0 commit comments