Skip to content

Commit

Permalink
fix(mjs): remove unused namespace build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alreadyExisted authored and sokra committed Jun 12, 2019
1 parent acf2c2d commit df5e118
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
5 changes: 2 additions & 3 deletions lib/dependencies/HarmonyExportImportedSpecifierDependency.js
Expand Up @@ -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)`
Expand Down
5 changes: 2 additions & 3 deletions lib/dependencies/HarmonyImportSpecifierDependency.js
Expand Up @@ -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)`
Expand Down
9 changes: 0 additions & 9 deletions 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\)/
]
Expand Down

0 comments on commit df5e118

Please sign in to comment.