From df5e118da4a58f1472826654e8b6baf777d7c08f Mon Sep 17 00:00:00 2001 From: alreadyExisted Date: Thu, 25 Apr 2019 18:58:20 +0300 Subject: [PATCH] fix(mjs): remove unused namespace build errors --- .../HarmonyExportImportedSpecifierDependency.js | 5 ++--- lib/dependencies/HarmonyImportSpecifierDependency.js | 5 ++--- test/cases/mjs/cjs-import-default/errors.js | 9 --------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index 19642ddff24..1183dc54256 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -355,12 +355,11 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { // It's not an harmony module if ( this.originModule.buildMeta.strictHarmonyModule && + this._id && this._id !== "default" ) { // In strict harmony modules we only support the default export - const exportName = this._id - ? `the named export '${this._id}'` - : "the namespace object"; + const exportName = `the named export '${this._id}'`; return [ new HarmonyLinkingError( `Can't reexport ${exportName} from non EcmaScript module (only default export is available)` diff --git a/lib/dependencies/HarmonyImportSpecifierDependency.js b/lib/dependencies/HarmonyImportSpecifierDependency.js index 9f681a6f312..76b9e2410bc 100644 --- a/lib/dependencies/HarmonyImportSpecifierDependency.js +++ b/lib/dependencies/HarmonyImportSpecifierDependency.js @@ -80,12 +80,11 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { // It's not an harmony module if ( this.originModule.buildMeta.strictHarmonyModule && + this._id && this._id !== "default" ) { // In strict harmony modules we only support the default export - const exportName = this._id - ? `the named export '${this._id}'` - : "the namespace object"; + const exportName = `the named export '${this._id}'`; return [ new HarmonyLinkingError( `Can't import ${exportName} from non EcmaScript module (only default export is available)` diff --git a/test/cases/mjs/cjs-import-default/errors.js b/test/cases/mjs/cjs-import-default/errors.js index 5e0f6e01254..49b98a34e6a 100644 --- a/test/cases/mjs/cjs-import-default/errors.js +++ b/test/cases/mjs/cjs-import-default/errors.js @@ -1,19 +1,10 @@ module.exports = [ - [ - /Can't import the namespace object from non EcmaScript module \(only default export is available\)/ - ], - [ - /Can't import the namespace object from non EcmaScript module \(only default export is available\)/ - ], [ /Can't import the named export 'data' from non EcmaScript module \(only default export is available\)/ ], [ /Can't import the named export 'data' from non EcmaScript module \(only default export is available\)/ ], - [ - /Can't reexport the namespace object from non EcmaScript module \(only default export is available\)/ - ], [ /Can't reexport the named export 'data' from non EcmaScript module \(only default export is available\)/ ]