Error: Cannot find module '@babel/preset-env' – @babel/core resolver
0 reputation · 17 Sept 2021, 04:21 UTC
The goal is to ensure Babel can locate and load a preset declared in the configuration so that the transformation pipeline proceeds without aborting due to a missing‑module error.
Currently the resolver treats each preset as an independent Node module requirement; there is no standardized way for a preset to declare dependencies on other presets or plugins that must be present beforehand. This leaves an open design question about whether Babel should adopt a dependency‑declaration mechanism that could influence load order and potentially prevent missing‑module errors caused by omitted transitive dependencies.
- Should presets be allowed to list required peer presets/plugins that Babel automatically resolves before loading the preset itself?
- Would introducing a preset dependency field alter the semantics of the existing left‑to‑right plugin/preset ordering guarantee?
- How would such a mechanism interact with version resolution and lockfiles without breaking backward compatibility?