aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@istanbuljs/load-nyc-config/load-esm.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@istanbuljs/load-nyc-config/load-esm.js')
-rw-r--r--node_modules/@istanbuljs/load-nyc-config/load-esm.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/node_modules/@istanbuljs/load-nyc-config/load-esm.js b/node_modules/@istanbuljs/load-nyc-config/load-esm.js
new file mode 100644
index 0000000..0eb517e
--- /dev/null
+++ b/node_modules/@istanbuljs/load-nyc-config/load-esm.js
@@ -0,0 +1,12 @@
+'use strict';
+
+const {pathToFileURL} = require('url');
+
+module.exports = async filename => {
+ const mod = await import(pathToFileURL(filename));
+ if ('default' in mod === false) {
+ throw new Error(`${filename} has no default export`);
+ }
+
+ return mod.default;
+};