systemjs / systemjs

Dynamic ES module loader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support import assertion

wenerme opened this issue · comments

Description of Proposed Feature

Same sematic of

import 'a'
import 'b' assert {type: 'css'}
import 'c'

await import('d', {assert:{type:'xyz'}})

In what way would you use it?

import

  • pass one more args #2433
System.register(
  ["a", 'b', "c"],
  () => void 0,
  [,{ assert: { type: "css" } } ,]
);

import()

System.import('d',{assert:{type:'xyz'}})

Would be great - Babel and TypeScript could also be updated to support this output when transpiling. I wonder how we would integrate it into the imports of the System.register format?

What do you mean integrate it into the imports of the System.register format ? Dose #2433 solve the problem ?

I guess the guidance needs to be put together for transpilers and tools primarily? Ie things like - should import assertions always be output? What format should they be output as? etc. You can PR https://github.com/systemjs/systemjs/blob/main/docs/system-register.md to update this guidance.

Note that the spec has now changed to import attributes and reuses the with keyword: