This is an automated email from the ASF dual-hosted git repository.

robin0716 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit 9479f1f80172cee4e61a376c96a8269fc2cc6c83
Author: robin <[email protected]>
AuthorDate: Tue Oct 8 16:52:36 2024 +0800

    chore(ui): Dynamically import plugins
---
 ui/scripts/plugin.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/scripts/plugin.js b/ui/scripts/plugin.js
index d554df8f..a3f09df5 100644
--- a/ui/scripts/plugin.js
+++ b/ui/scripts/plugin.js
@@ -63,7 +63,8 @@ function addPluginToIndexTs(packageName) {
   const indexTsContent = fs.readFileSync(indexTsPath, 'utf-8');
   const lines = indexTsContent.split('\n');
   const ComponentName = pascalize(packageName);
-  const importLine = `export { default as ${ComponentName} } from 
'${packageName}';`;
+
+  const importLine = `export const load${ComponentName} = () => 
import('${packageName}').then(module => module.default);`;
   if (!lines.includes(importLine)) {
     lines.push(importLine);
   }

Reply via email to