Skip to content

Commit

Permalink
fix(setup-component): cannot load component in production
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Nov 14, 2022
1 parent 19f1611 commit 19d3544
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-waves-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vue-macros/setup-component': patch
---

cannot load component in production
10 changes: 6 additions & 4 deletions packages/setup-component/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@ export const transformPost = (code: string, _id: string) => {
)
} else if (
node.type === 'Identifier' &&
parent.type === 'CallExpression' &&
parent.callee.type === 'Identifier' &&
parent.callee.name === '_export_sfc' &&
node.name === '_sfc_main'
node.name === '_sfc_main' &&
((parent.type === 'CallExpression' &&
parent.callee.type === 'Identifier' &&
parent.callee.name === '_export_sfc' &&
node.name === '_sfc_main') ||
parent.type === 'ExportDefaultDeclaration')
) {
s.appendLeft(node.end!, '(ctx)')
}
Expand Down

0 comments on commit 19d3544

Please sign in to comment.