mirror of
https://github.com/knex/knex.git
synced 2025-06-26 22:00:25 +00:00
13 lines
322 B
JavaScript
13 lines
322 B
JavaScript
const isModuleType = require('./is-module-type');
|
|
|
|
/**
|
|
* imports 'mjs', else requires.
|
|
* NOTE: require me late!
|
|
* @param {string} filepath
|
|
*/
|
|
module.exports = async function importFile(filepath) {
|
|
return (await isModuleType(filepath))
|
|
? import(require('url').pathToFileURL(filepath))
|
|
: require(filepath);
|
|
};
|