mirror of
https://github.com/knex/knex.git
synced 2025-07-09 18:11:17 +00:00
12 lines
329 B
JavaScript
12 lines
329 B
JavaScript
![]() |
/**
|
||
|
* imports 'mjs', else requires.
|
||
|
* NOTE: require me late!
|
||
|
* @param {string} filepath
|
||
|
* @todo WARN on version 10 and '--experimental-modules' and '--esm'
|
||
|
*/
|
||
|
module.exports = function importFile(filepath) {
|
||
|
return filepath.endsWith('.mjs')
|
||
|
? import(require('url').pathToFileURL(filepath))
|
||
|
: require(filepath);
|
||
|
};
|