How can I access a json file in Ecmascript 6 ? The following doesn't work:
import config from '../config.json'
This works fine if I try to import a JavaScript file.
In TypeScript or using Babel, you can import json file in your code.
// Babel
import * as data from './example.json';
const word = data.name;
console.log(word); // output 'testing'
Reference: https://hackernoon.com/import-json-into-typescript-8d465beded79