Skip to content

Commit

Permalink
chore(build): adjust dir structure of production (#2654)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Nov 18, 2023
1 parent 73ec65b commit fe8399f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
14 changes: 5 additions & 9 deletions scripts/generate-unplugin-deps.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 2 additions & 2 deletions vite.config.build.disperse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
}
},
Expand Down
4 changes: 2 additions & 2 deletions vite.config.build.taro.vue.disperse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
}
},
Expand Down

0 comments on commit fe8399f

Please sign in to comment.