jspm / generator

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

Automatic env detection from input map #145

Closed guybedford closed 1 year ago

guybedford commented 2 years ago

Now that we are doing comprehensive input map analysis and decomposition, we can also possibly detect the conditional environment from the input map based on what resolutions are present.

This could also env to be defaulted correctly when not otherwise provided.

Although not full-proof, since having no env mappings would effectively lose this information, it may well provide a good enough approach to this long-standing problem.

Bubblyworld commented 1 year ago

Just some notes for my future brain, we chatted about this and came to the conclusion that having an explicit "env" field in the output maps has a lot of benefits, like making users aware that import maps are environment specific by nature. On the other hand it will cause some warnings, so we should probably revisit this once jspm gets traction.

guybedford commented 1 year ago

Let's move this discussion into being tracked as lockfile support in https://github.com/jspm/generator/issues/262 for now. We can always reopen this approach if the decisions change though.