From 33e70f9af807f9630bb729403a1572379951f311 Mon Sep 17 00:00:00 2001 From: PeachScript Date: Sat, 7 Oct 2023 15:02:28 +0800 Subject: [PATCH] fix: unexpected exports in demo pre-compiling result --- packages/preset-dumi/src/transformer/demo/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/preset-dumi/src/transformer/demo/index.ts b/packages/preset-dumi/src/transformer/demo/index.ts index 65c54ccd38..e8ba9aa504 100644 --- a/packages/preset-dumi/src/transformer/demo/index.ts +++ b/packages/preset-dumi/src/transformer/demo/index.ts @@ -59,7 +59,7 @@ export default (raw: string, opts: IDemoOpts): IDemoTransformResult => { callPathNode.left.object.name === 'exports' ) { // remove original export expression - if (types.isIdentifier(callPathNode.right)) { + if (types.isIdentifier(callPathNode.right) || types.isFunctionExpression(callPathNode.right)) { // save export function as return statement arg if (isDynamicEnable()) { // for dynamic({ loader }), transform to return _default;