From 618432aed41f92cb3526f6597e7f2111ce022227 Mon Sep 17 00:00:00 2001 From: eiinu Date: Mon, 13 Nov 2023 16:15:44 +0800 Subject: [PATCH] chore: remove unnecessary treeshaking code --- scripts/generate-unplugin-deps.cjs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/generate-unplugin-deps.cjs b/scripts/generate-unplugin-deps.cjs index 49399fe9ad..87a117a1b6 100644 --- a/scripts/generate-unplugin-deps.cjs +++ b/scripts/generate-unplugin-deps.cjs @@ -25,16 +25,12 @@ config.nav.forEach((item) => { if (element.exclude != true) { let outputMjs = ''; if (element.type == 'methods' && target == 'nutui') { - outputMjs = `import _${element.name} from '../_es/${element.name}.js'; + outputMjs = `import ${element.name} from '../_es/${element.name}.js'; import { show${element.name} } from '../_es/${element.name}.js'; -const treeshaking = (t) => t; -const ${element.name} = treeshaking(_${element.name}); -export { ${element.name}, show${element.name} };`; +export { ${element.name}, show${element.name}, ${element.name} as default };`; } else { - outputMjs = `import _${element.name} from '../_es/${element.name}.js'; -const treeshaking = (t) => t; -const ${element.name} = treeshaking(_${element.name}); -export { ${element.name} };`; + outputMjs = `import ${element.name} from '../_es/${element.name}.js'; +export { ${element.name}, ${element.name} as default };`; } tasks.push( fs.outputFile(path.resolve(__dirname, `../dist/packages/${element.name}/index.mjs`), outputMjs, 'utf8', () => {