diff --git a/src/astring.js b/src/astring.js index 5effb2e0..60742558 100644 --- a/src/astring.js +++ b/src/astring.js @@ -604,7 +604,11 @@ export const baseGenerator = { } }, ExportAllDeclaration(node, state) { - state.write('export * from ') + if (node.exported != null) { + state.write('export * as ' + node.exported.name + ' from ') + } else { + state.write('export * from ') + } this.Literal(node.source, state) state.write(';') }, diff --git a/src/tests/fixtures/syntax/export.js b/src/tests/fixtures/syntax/export.js index 072fa9d5..9487783d 100644 --- a/src/tests/fixtures/syntax/export.js +++ b/src/tests/fixtures/syntax/export.js @@ -1,4 +1,5 @@ export * from "module"; +export * as m from "module"; export {name} from "module"; export {a as b, c as d} from "module"; let e, g;