1+ import { execSync } from 'node:child_process'
12import { resolve } from 'node:path'
23import vue from '@vitejs/plugin-vue'
34import vueJsx from '@vitejs/plugin-vue-jsx'
@@ -22,6 +23,13 @@ export default defineConfig({
2223 tsconfigPath : 'tsconfig.build.json' ,
2324 exclude : [ 'src/test/**' , 'src/**/stories/**' , 'src/**/*.stories.vue' ] ,
2425 rollupTypes : true ,
26+ afterBuild : async ( ) => {
27+ console . log ( 'dts afterBuild' )
28+ // pnpm build:plugins
29+ execSync ( 'pnpm build:plugins' , { stdio : 'inherit' , cwd : resolve ( __dirname , '../plugins' ) } )
30+ execSync ( 'pnpm generate:plugins' , { stdio : 'inherit' , cwd : resolve ( __dirname , '../plugins' ) } )
31+ execSync ( 'pnpm lint:fix' , { stdio : 'inherit' , cwd : resolve ( __dirname , '../..' ) } )
32+ } ,
2533 } ) ,
2634 ] ,
2735 resolve : {
@@ -37,9 +45,10 @@ export default defineConfig({
3745 lib : {
3846 name : 'oku-ui-primitives' ,
3947 formats : [ 'es' ] ,
40- fileName : ( _ , name ) => `${ name } .mjs` ,
48+ fileName : ( format , entryName ) => `${ entryName } .mjs` ,
4149 entry : {
4250 index : resolve ( __dirname , 'src/index.ts' ) ,
51+ constant : resolve ( __dirname , 'src/constant/index.ts' ) ,
4352 } ,
4453 } ,
4554 rollupOptions : {
@@ -48,18 +57,22 @@ export default defineConfig({
4857 ...Object . keys ( pkg . peerDependencies ?? { } ) ,
4958 ] ,
5059 output : {
51- manualChunks : ( id ) => {
52- // Daha basit chunk stratejisi
53- const chunks = id . match ( / [ / \\ ] s r c [ / \\ ] ( .* ?) [ / \\ ] / )
54- return chunks ? chunks [ 1 ] : null
60+ manualChunks ( id ) {
61+ if ( id . includes ( 'node_modules' ) ) {
62+ // vendor kodlarını gruplayalım
63+ return 'vendor'
64+ }
65+ // src altındaki ana klasörleri ayrı chunk'lara bölelim
66+ const match = id . match ( / [ / \\ ] s r c [ / \\ ] ( .* ?) [ / \\ ] / )
67+ if ( match && match [ 1 ] ) {
68+ return match [ 1 ]
69+ }
5570 } ,
5671 exports : 'named' ,
5772 chunkFileNames : '[name].mjs' ,
58- assetFileNames : 'index.css' ,
59- hoistTransitiveImports : false ,
73+ hoistTransitiveImports : true ,
6074 minifyInternalExports : true ,
6175 } ,
6276 } ,
63-
6477 } ,
6578} )
0 commit comments