jspm / generator

JSPM Import Map Generator
Apache License 2.0
166 stars 21 forks source link

Non-deterministic resolution #85

Closed vovacodes closed 2 years ago

vovacodes commented 2 years ago

Notice how @babel/runtime/helpers/typeof's mapping randomly switches between https://ga.jspm.io/npm:@babel/runtime@7.16.0/helpers/typeof.js and https://ga.jspm.io/npm:@babel/runtime@7.16.0/helpers/esm/typeof.js

https://user-images.githubusercontent.com/1524432/142737757-8803e41f-8b79-4398-a477-e71ad9e70818.mov

guybedford commented 2 years ago

It is a known problem and is caused by "require" and "import" branches in the import map not having a well-defined "single solution". Determinism would be fixed by https://github.com/jspm/generator/issues/40. The question of which to use when "require" and "import" intersect (and these are the only conditions that do intersect within the same environment), could possibly be solved by always using one or the other and ensuring that is a fixed rule.

guybedford commented 2 years ago

Resolved in https://github.com/jspm/generator/pull/86 by giving "require" precedence in conflicts.