Skip to content

Commit

Permalink
fix: click-to-react-component should only be run in dev (#12764)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc authored Nov 4, 2024
1 parent f57d1f0 commit 7d8a08e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ export default (api: IApi) => {
enableBy: api.env === 'development' ? api.EnableBy.config : () => false,
});

const pkgPath = dirname(require.resolve('click-to-react-component'));
api.modifyConfig((memo) => {
const pkgPath = dirname(require.resolve('click-to-react-component'));
memo.alias['click-to-react-component'] = pkgPath;
return memo;
});

api.modifyAppData((memo) => {
const pkgPath = dirname(require.resolve('click-to-react-component'));
memo.clickToComponent = {
pkgPath,
version: '1.0.8',
};
return memo;
});

api.onGenerateFiles({
name: 'clickToComponent',
fn: () => {
Expand Down Expand Up @@ -61,6 +63,7 @@ return React.createElement(
});
},
});

api.addRuntimePlugin(() => [
winPath(join(api.paths.absTmpPath, 'plugin-clickToComponent/runtime.tsx')),
]);
Expand Down

0 comments on commit 7d8a08e

Please sign in to comment.