Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue with reexporting default as default with {exports: named,…
… interop: true} options. (#2620)
- Loading branch information
1 parent
7cc2f62
commit f5364d9
Showing
9 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test/form/samples/re-export-default-external-as-default/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
description: 're-exports a default external import as default export (when using named exports)', | ||
options: { | ||
output: { name: 'reexportsDefaultExternalAsDefault', exports: 'named' }, | ||
external: ['external'] | ||
} | ||
}; |
12 changes: 12 additions & 0 deletions
12
test/form/samples/re-export-default-external-as-default/_expected/amd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define(['exports', 'external'], function (exports, external) { 'use strict'; | ||
|
||
var external__default = 'default' in external ? external['default'] : external; | ||
|
||
|
||
|
||
Object.keys(external).forEach(function (key) { exports[key] = external[key]; }); | ||
exports.default = external__default; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
13 changes: 13 additions & 0 deletions
13
test/form/samples/re-export-default-external-as-default/_expected/cjs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
|
||
var external = require('external'); | ||
var external__default = _interopDefault(external); | ||
|
||
|
||
|
||
Object.keys(external).forEach(function (key) { exports[key] = external[key]; }); | ||
exports.default = external__default; |
2 changes: 2 additions & 0 deletions
2
test/form/samples/re-export-default-external-as-default/_expected/es.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from 'external'; | ||
export { default } from 'external'; |
13 changes: 13 additions & 0 deletions
13
test/form/samples/re-export-default-external-as-default/_expected/iife.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var reexportsDefaultExternalAsDefault = (function (exports, external) { | ||
'use strict'; | ||
|
||
var external__default = 'default' in external ? external['default'] : external; | ||
|
||
|
||
|
||
Object.keys(external).forEach(function (key) { exports[key] = external[key]; }); | ||
exports.default = external__default; | ||
|
||
return exports; | ||
|
||
}({}, external)); |
19 changes: 19 additions & 0 deletions
19
test/form/samples/re-export-default-external-as-default/_expected/system.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
System.register('reexportsDefaultExternalAsDefault', ['external'], function (exports, module) { | ||
'use strict'; | ||
var _starExcludes = { default: 1 }; | ||
return { | ||
setters: [function (module) { | ||
var _setter = {}; | ||
for (var _$p in module) { | ||
if (!_starExcludes[_$p]) _setter[_$p] = module[_$p]; | ||
} | ||
_setter.default = module.default; | ||
exports(_setter); | ||
}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
16 changes: 16 additions & 0 deletions
16
test/form/samples/re-export-default-external-as-default/_expected/umd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('external')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'external'], factory) : | ||
(global = global || self, factory(global.reexportsDefaultExternalAsDefault = {}, global.external)); | ||
}(this, function (exports, external) { 'use strict'; | ||
|
||
var external__default = 'default' in external ? external['default'] : external; | ||
|
||
|
||
|
||
Object.keys(external).forEach(function (key) { exports[key] = external[key]; }); | ||
exports.default = external__default; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
})); |
2 changes: 2 additions & 0 deletions
2
test/form/samples/re-export-default-external-as-default/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from 'external'; | ||
export { default } from 'external'; |