You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
374 B
14 lines
374 B
3 years ago
|
const fs = require('fs')
|
||
|
const JSON5 = require('./')
|
||
|
|
||
|
// eslint-disable-next-line node/no-deprecated-api
|
||
|
require.extensions['.json5'] = function (module, filename) {
|
||
|
const content = fs.readFileSync(filename, 'utf8')
|
||
|
try {
|
||
|
module.exports = JSON5.parse(content)
|
||
|
} catch (err) {
|
||
|
err.message = filename + ': ' + err.message
|
||
|
throw err
|
||
|
}
|
||
|
}
|