loader icon indicating copy to clipboard operation
loader copied to clipboard

Importing JSON files?

Open beck opened this issue 10 years ago • 2 comments

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?

beck avatar Mar 29 '16 01:03 beck

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.

guybedford avatar Mar 29 '16 05:03 guybedford

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

caridy avatar Mar 29 '16 06:03 caridy