diff --git a/scripts/generate-unplugin-deps.cjs b/scripts/generate-unplugin-deps.cjs index 49399fe9ad..4e8e67790e 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'; -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} };`; + outputMjs = `import ${element.name} from './${element.name}.js'; +import { show${element.name} } from './${element.name}.js'; +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 './${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', () => { diff --git a/vite.config.build.disperse.ts b/vite.config.build.disperse.ts index ccbec5575f..604021fe89 100644 --- a/vite.config.build.disperse.ts +++ b/vite.config.build.disperse.ts @@ -36,8 +36,8 @@ export default defineConfig({ paths: { '@/packages/locale': '../locale/lang' }, - dir: path.resolve(__dirname, './dist/packages/_es'), - entryFileNames: '[name].js', + dir: path.resolve(__dirname, './dist/packages'), + entryFileNames: (chunkInfo) => `${chunkInfo.name.toLowerCase()}/${chunkInfo.name}.js`, plugins: [] } }, diff --git a/vite.config.build.taro.vue.disperse.ts b/vite.config.build.taro.vue.disperse.ts index 320d27b460..7b28b1bbd7 100644 --- a/vite.config.build.taro.vue.disperse.ts +++ b/vite.config.build.taro.vue.disperse.ts @@ -59,8 +59,8 @@ export default defineConfig({ paths: { '@/packages/locale': '../locale/lang' }, - dir: path.resolve(__dirname, './dist/packages/_es'), - entryFileNames: '[name].js', + dir: path.resolve(__dirname, './dist/packages'), + entryFileNames: (chunkInfo) => `${chunkInfo.name.toLowerCase()}/${chunkInfo.name}.js`, plugins: [] } },