From 1ac90554ab4456f70b0fcc1ce006b563dbe967ef Mon Sep 17 00:00:00 2001 From: johvin Date: Sun, 6 May 2018 21:16:09 +0800 Subject: [PATCH] give up destructure syntax to be compatible with Node.js v4 --- dist/index.js | 5 ++++- index.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2ccfbef..1209124 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33,7 +33,10 @@ exports.resolve = (modulePath, sourceFile, config) => { config = {}; } - const { map, extensions } = config; + // in order to be compatible with Node.js v4, + // give up destructure syntax + const map = config.map; + const extensions = config.extensions; const sourceDir = path.dirname(sourceFile); let resolvePath = modulePath; diff --git a/index.js b/index.js index 2ccfbef..1209124 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,10 @@ exports.resolve = (modulePath, sourceFile, config) => { config = {}; } - const { map, extensions } = config; + // in order to be compatible with Node.js v4, + // give up destructure syntax + const map = config.map; + const extensions = config.extensions; const sourceDir = path.dirname(sourceFile); let resolvePath = modulePath;