Skip to content

Commit

Permalink
fix: 修复开启 mako (缺少webpack插件)后 clicktocomponent 无法打开 vscode 的问题 (#12775)
Browse files Browse the repository at this point in the history
Co-authored-by: hanzebang.hzb <[email protected]>
  • Loading branch information
hanzebang and hanzebang.hzb authored Nov 14, 2024
1 parent c4bf5c0 commit 7c7b58f
Showing 1 changed file with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,28 @@ export default (api: IApi) => {
content: `
import { ClickToComponent } from 'click-to-react-component';
import React from 'react';
const pathModifier = (path) => {
return path.startsWith('${api.paths.cwd}') ? path : '${
api.paths.cwd
}/' + path;
}
export function rootContainer(container, opts) {
return React.createElement(
(props) => {
return (
<>
<ClickToComponent editor="${
api.config.clickToComponent.editor || 'vscode'
}"/>
{props.children}
</>
);
},
opts,
container,
);
return React.createElement(
(props) => {
return (
<>
<ClickToComponent editor="${
api.config.clickToComponent.editor || 'vscode'
}" pathModifier={pathModifier} />
{props.children}
</>
);
},
opts,
container,
);
}
`,
});
Expand Down

0 comments on commit 7c7b58f

Please sign in to comment.