From 57a71df593cdd301f91b879de38439228a986408 Mon Sep 17 00:00:00 2001 From: David Bushong Date: Fri, 6 Dec 2019 14:07:57 -0800 Subject: [PATCH] fix: node8 support --- lib/esm/index.js | 2 +- lib/project.js | 1 + test/project.test.js | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/esm/index.js b/lib/esm/index.js index 1e4b348..3f82e99 100644 --- a/lib/esm/index.js +++ b/lib/esm/index.js @@ -40,7 +40,7 @@ try { importESM = require('./import'); } catch (err) { debug('failed to load esm import: ', err); - importESM = () => Promise.reject(err); + importESM = () => Promise.reject(new Error('Not supported')); } exports.importESM = importESM; diff --git a/lib/project.js b/lib/project.js index 0490f84..75b08e7 100644 --- a/lib/project.js +++ b/lib/project.js @@ -205,6 +205,7 @@ class Project { * @returns {T} */ require(id) { + debug('require', id); return this.app.require(id); } diff --git a/test/project.test.js b/test/project.test.js index de40ba5..1744b81 100644 --- a/test/project.test.js +++ b/test/project.test.js @@ -58,6 +58,8 @@ module.exports = 'from lib1'; `, }; if (await supportsESM()) { + // eslint-disable-next-line no-console + console.log(' [esm support enabled]'); files['modules/mod1/everywhere.mjs'] = `\ export default 'from mod1'; export const namedExport = 'forwarded';