TheLarkInn / unity-component-specification

This is a WIP draft of the Unity (Single File Web Component) Specification
Apache License 2.0
217 stars 2 forks source link

Enforce type=module for ESM #3

Open bmeck opened 6 years ago

bmeck commented 6 years ago

Required for export syntax in DOM.

TheLarkInn commented 6 years ago

That's a good idea to have. Only thing is that this could technically be an entirely separate module format. So for example just being a different module type could be the signal to V8/Eval/Interpretor that whatever is inside of the tag is an ESM module.

If that's not strong enough we could certainly talk about having that.

ChadKillingsworth commented 6 years ago

If it uses a script tag, we should definitely require type=module. I think I am mentioning this 3 times in my Polymer presentation.

TheLarkInn commented 6 years ago

That is if it is HTML!

bmeck commented 6 years ago

If you aren't writing html please use non-conflicting tag names

TheLarkInn commented 6 years ago

Other languages share syntax in one way or another. The goal is to have likeness to respective techniques, that can be parsed accordingly, meanwhile augmenting the behavior.

Honestly I don't see a problem with script type module. But I also don't see it necessary also.

bmeck commented 6 years ago

Other languages share syntax in one way or another. The goal is to have likeness to respective techniques, that can be parsed accordingly, meanwhile augmenting the behavior.

I agree, as long as we don't ever call this stuff HTML that seems fine.

It seems odd that it looks so much like HTML on that point. Is there a reason to look similar enough to be mistakable but not conform? Doesn't that just add overhead vs making a different syntax?

Honestly I don't see a problem with script type module.

Because it invalidates programmer intuition that script tags are Scripts without type=module. They now need domain specific knowledge around how their toolchain works w/ pseudo-HTML.

But I also don't see it necessary also.

I tend to think that things should not be done solely when necessary, very few things are truly necessary. I argue that it is necessary to include type=module for consistency if this language which is not HTML is attempting to use HTML semantics without adding to developer fatigue.