whatwg / loader

Loader Standard
https://whatwg.github.io/loader/
Creative Commons Zero v1.0 Universal
609 stars 45 forks source link

Importing JSON files? #133

Open beck opened 8 years ago

beck commented 8 years ago

Led here from: https://esdiscuss.org/topic/importing-json-files

Looking through the issues and discussion, unable to find a clear answer.

There is a ticket discussing Import non-JS code from the import declaration.

Considering the ubiquity of JSON, has there been any discussion on giving it native support?

guybedford commented 8 years ago

This sort of thing can be done through a custom format loading with the loader hooks.

In SystemJS the above method is provided via SystemJS.config({ meta: { 'app/*.json': { format: 'json' } } }).

Any spec inclusion is of course separate to the above, but just to mention this approach.

caridy commented 8 years ago

yeah. I suspect that the default loader implemented in each engine will support json, but we haven't get to define that just yet.