Giter Site home page Giter Site logo

Comments (12)

devsnek avatar devsnek commented on August 26, 2024 3

@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. type: module seems like a tautology to me, all modules are modules.

from proposal-import-attributes.

littledan avatar littledan commented on August 26, 2024 2

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 type: "js" for a basic proposal when assessing coherence/viability of it. So I think coming to a conclusion on this question blocks Stage 3, but not Stage 2.

from proposal-import-attributes.

littledan avatar littledan commented on August 26, 2024 1

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 type: "module" suggestion seems pretty confusing to me, since all of these things are modules... The notion of type here does not correspond to classic/script vs module. I'd prefer type: "js" or type: "javascript" if we include one of these.)

from proposal-import-attributes.

ljharb avatar ljharb commented on August 26, 2024 1

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.

from proposal-import-attributes.

devsnek avatar devsnek commented on August 26, 2024

type: 'source-text-module' perhaps, but not type: 'js'

from proposal-import-attributes.

MylesBorins avatar MylesBorins commented on August 26, 2024

from proposal-import-attributes.

Jack-Works avatar Jack-Works commented on August 26, 2024

Allowing a "js" type may simplify the code generation work

from proposal-import-attributes.

xtuc avatar xtuc commented on August 26, 2024

If an enviroment would want to only load modules with a type attribute we need to allow JS, however I'm not convienced that developers would use it if not necessary.

from proposal-import-attributes.

Jamesernator avatar Jamesernator commented on August 26, 2024

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)] } });

from proposal-import-attributes.

guybedford avatar guybedford commented on August 26, 2024

"type": "javascript" is currently not implemented in Chrome. While a missing type is treated as JS equivalent in the spec, I think it would be useful to have further implementation guidance from the spec if hosts are expected to implement this type or not, which also relates to the JS / WebAssembly assertion discussion. If guidance is still unclear here then that should also be clarified in the spec.

from proposal-import-attributes.

GeoffreyBooth avatar GeoffreyBooth commented on August 26, 2024

If guidance is still unclear here then that should also be clarified in the spec.

In #114 I suggested that the proposal include type: 'javascript' to align with the HTML spec. Basically, the lack of an assertion type implies type: 'javascript', and cannot imply any other type.

from proposal-import-attributes.

ljharb avatar ljharb commented on August 26, 2024

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".

from proposal-import-attributes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.