-
Notifications
You must be signed in to change notification settings - Fork 43
Feature: Transparent migration #105
Comments
This relates heavily to #90; if "no transparent interop" is decided, this use case becomes impossible. |
That really depends on your workflow/toolchain. The one that we're trying to push at Babel is the babel-preset-env approach. The user don't need to worry about CJS or ESM because the preset will decide which one to pick based on the target. The conclusion is that it will be transparent for the user and I think that's a good thing. |
This sounds to me more like an issue of "importing a dependency without needing to know the module type" than gradual migration of source text goals, which already seems to be tracked in #99. I'd like to propose changing the name to "Format-independent imports" or similar, including in the README reference. |
🚲 🏠 I like the name "Agnostic consumer" defined in one of the terminology Google docs. I feel that it better put emphasis on the fact the consumer does not know the module type of the dependency. The kind of imports compatible with agnostic consumers may be roughly ordered by "strength": simple bare specifiers (package main), intra-package, extra-package deep imports. Some proposals do not support it at every level. #99 seems to be focused on intra-package imports. See also #138 for more discussions about "transparent interop". |
As I’m gradually migrating my CommonJS package to ESM one file at a time (see also #99 and #90), I can do so without needing to know or look up the module types of my dependencies. I don’t need to rely on dependencies’ READMEs or
package.json
s or source code to know their module types, nor do I need to resort to trial and error.This migration of my package does not cause a breaking change for any apps using my package’s API, nor for any apps importing my package as a dependency.
When I’m done migrating to all
import
andexport
statements, I can remove the Babel modules transform (or my entire build step) and the package functions the same as before.Use cases 18, 20, 39, 40.
The text was updated successfully, but these errors were encountered: