Skip to content

Commit

Permalink
fix(babel): 修复babel添加part插件失效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LzhengH committed Jan 16, 2025
1 parent a5693eb commit a886888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion plugins/babel-plugin-add-part-attribute.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ module.exports = function ({ types: t }) {
visitor: {
CallExpression(path) {
const { node } = path;
if (t.isIdentifier(node.callee, { name: 'h' })) {
const { callee } = node;
if (
t.isMemberExpression(callee) &&
t.isIdentifier(callee.object, { name: 'Component' }) &&
t.isIdentifier(callee.property, { name: 'h' })
) {
const [type, props] = node.arguments;

// t-开头的标签忽略
Expand Down

0 comments on commit a886888

Please sign in to comment.