Skip to content

Commit 627b897

Browse files
fatfisztleunen
authored andcommitted
feat: Handle the "export from" statement (#129)
Closes #128
1 parent e3597b8 commit 627b897

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,10 @@ export default ({ types: t }) => ({
8484
transformImportCall(t, nodePath, mapModule, state, this.moduleResolverCWD);
8585
},
8686
},
87+
ExportDeclaration: {
88+
exit(nodePath, state) {
89+
transformImportCall(t, nodePath, mapModule, state, this.moduleResolverCWD);
90+
},
91+
},
8792
},
8893
});

test/index.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ describe('module-resolver', () => {
1818

1919
expect(result.code).toBe(`import something from "${output}";`);
2020
});
21+
22+
it('with an "export from" statement', () => {
23+
const code = `export { something } from "${source}";`;
24+
const result = transform(code, transformerOpts);
25+
26+
expect(result.code).toBe(`export { something } from "${output}";`);
27+
});
28+
29+
it('with an export statement', () => {
30+
const code = 'export { something };';
31+
const result = transform(code, transformerOpts);
32+
33+
expect(result.code).toBe('export { something };');
34+
});
2135
}
2236

2337
describe('root', () => {

0 commit comments

Comments
 (0)