Created
March 31, 2022 23:27
-
-
Save jkeefe/577c3ece872f451fc62510544547ec22 to your computer and use it in GitHub Desktop.
nifty trick to bring in json files using require in a module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// nifty trick to bring in json files using require in a module | |
import { createRequire } from "module"; // Bring in the ability to create the 'require' method | |
const require = createRequire(import.meta.url); // construct the require method | |
const trainData = require('./src/data/latest.json') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment