-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should type: "js" work? #49
Comments
|
I disagree with that suggestion Gus. We are not making it `type:
'text/json'` specifically because folks shouldn't have to know about
internals.
Maybe `type: 'module'`?
…On Thu, Mar 26, 2020, 5:22 PM Gus Caplan ***@***.***> wrote:
type: 'source-text-module' perhaps, but not type: 'js'
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADZYV56VEPUTJFOY6IJGWDRJPBPXANCNFSM4LURBAXQ>
.
|
@MylesBorins maybe my intent was lost... all these modules are modules, but I assume the suggestion here is about modules authored as source text ecmascript modules. |
Allowing a "js" type may simplify the code generation work |
I'd suggest omitting this. We will have to support the case where no type is specified. Is there really that significant of a benefit to include multiple ways to spell this case? (The |
I want to suggest: we can come back and add this between Stage 2 and 3 (or even later, after initially shipping, why not), but that we don't need |
If an enviroment would want to only load modules with a |
I imagine people would want to use it in dynamic imports just for completeness e.g.: const types = {
".js": "js",
".wasm": "webassembly",
".json": "json",
".html": "html",
}
const module = await import(url, { if: { type: types[getExtension(url)] } }); |
|
That's not what was discussed in plenary, where consensus (as i recall) was to allow hosts to make any number of optional types that can mean the same thing as "no assertion". |
There's the additional piece that Ecma doesn't own the copyright to the word "javascript" and I'm not sure if we'd be able to encode that in the spec. |
Not sure if this has been discussed yet, but it occurred to me that we should consider allowing "js" (or maybe the full "javascript") as a valid value for the type key, e.g.:
Which would be exactly equivalent to just:
Pro: Consistency. It could be surprising to developers that specifying the type for "js" is is an error while other module types require it to be specified.
Con: Now there would be two ways to do the same thing since JS is the default.
Thoughts? I'm leaning towards saying that it should be supported but this is not a strongly held opinion.
The text was updated successfully, but these errors were encountered: