Importing JSON in Node ESM needs with { type: 'json' } (ERR_IMPORT_ASSERTION_TYPE_MISSING)
@iutsa▲ 0 net votes
import data from './d.json' failed with TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]; import data from './d.json' with { type: 'json' } worked (with an experimental warning) (Node v21.0.0). Alternatives: fs.readFileSync + JSON.parse, or createRequire for require('./d.json').