Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

ES import(specifier) #81

Closed
kitsonk opened this issue Mar 9, 2017 · 6 comments
Closed

ES import(specifier) #81

kitsonk opened this issue Mar 9, 2017 · 6 comments
Milestone

Comments

@kitsonk
Copy link
Member

kitsonk commented Mar 9, 2017

Enhancement

ECMAScript has a Stage 3 proposal for dynamic imports, using the syntax import(specifier) which solves the challenges around dynamic non-top level imports in code.

There is some work on TypeScript to support this within TypeScript, but would still need a global "shim" to provide the functionality. I think there are three things to consider:

  • Identify any functionality gaps between the proposal and our requirements that might need to be continue to be provided (e.g. support AMD or Webpack loading)
  • Provide the functionality as dojo/shim/import (though it will likely need to be global)
  • Potentially modify/change the dojo/loader to expose import() as well as require() and define()?
  • Deprecate dojo/core/load and migrate the webpack loader functionality into the shim.
@Jessidhia
Copy link

Jessidhia commented Mar 9, 2017

Note that, while import looks like a function, it is not a function, and is actually impossible to implement as a function, which is why they had to make it a keyword to begin with. If you are going to provide something, it will need to either emulate one of the module APIs that TypeScript can already target, or a new target needs to be made.

@kitsonk
Copy link
Member Author

kitsonk commented Mar 9, 2017

@Kovensky fair point, it is a new binding form that isn't a function. So maybe it is best to maintain load but potentially offload toimport(...) when present in the native environment, or maybe just wait to see what happens with the TypeScript transpilation of import(...).

@dylans
Copy link
Member

dylans commented Mar 17, 2017

We should probably close dojo/meta#133 in favor of this one @kitsonk ?

@kitsonk
Copy link
Member Author

kitsonk commented Mar 17, 2017

We also need to keep an eye on microsoft/TypeScript#14495 in relationship to this. It may obviate us doing anything.

@dylans
Copy link
Member

dylans commented Apr 7, 2017

We also need to keep an eye on microsoft/TypeScript#14495 in relationship to this. It may obviate us doing anything.

Currently targeted for TS 2.3.1.

@dylans dylans modified the milestones: 2017.04, 2017.05 Apr 7, 2017
@eheasley eheasley modified the milestones: 2017.05, 2017.06 Jun 6, 2017
@kitsonk
Copy link
Member Author

kitsonk commented Jun 28, 2017

This has been implemented in TypeScript 2.4.1 and is considered syntax that is down emitted to ES5. Therefore we have no need to implement this anymore.

@kitsonk kitsonk closed this as completed Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants