Skip to content

Commit

Permalink
Add test case for handling and deduplicating multiple synthetic named…
Browse files Browse the repository at this point in the history
… and default imports
  • Loading branch information
lukastaegert committed Jan 7, 2020
1 parent bb5b1b3 commit 3124824
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
description: 'handles importing a synthetic named export together with the default export',
options: {
input: ['main', 'main2'],
plugins: [
{
name: 'test-plugin',
transform(code) {
return {
code,
syntheticNamedExports: true
};
}
}
]
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var lib = { foo: true, bar: true, baz: true };

var foo = lib.foo;
export { foo as f, lib as l };
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { f as foo, l as lib } from './generated-lib.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { l as lib } from './generated-lib.js';

console.log(lib, lib.foo, lib.bar, lib.baz);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { foo: true, bar: true, baz: true };
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as lib, foo } from './lib.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import lib, { foo, bar, baz } from './lib.js';
console.log(lib, foo, bar, baz);

0 comments on commit 3124824

Please sign in to comment.