Skip to content

Commit 3e1e7d8

Browse files
fix: nuxt module (#576)
1 parent f7b6d98 commit 3e1e7d8

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

packages/core/package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,22 @@
3333
"default": "./dist/nuxt/index.cjs"
3434
}
3535
},
36+
"./contast": {
37+
"import": {
38+
"types": "./dist/constant.d.mts",
39+
"default": "./dist/constant.mjs"
40+
}
41+
},
3642
"./resolver": {
3743
"import": {
3844
"types": "./dist/resolver/index.d.mts",
3945
"default": "./dist/resolver/index.mjs"
40-
},
41-
"require": {
42-
"types": "./dist/resolver/index.d.cts",
43-
"default": "./dist/resolver/index.cjs"
4446
}
4547
},
4648
"./namespaced": {
4749
"import": {
4850
"types": "./dist/namespaced/index.d.mts",
4951
"default": "./dist/namespaced/index.mjs"
50-
},
51-
"require": {
52-
"types": "./dist/namespaced/index.d.cts",
53-
"default": "./dist/namespaced/index.cjs"
5452
}
5553
}
5654
},
@@ -73,6 +71,10 @@
7371
"namespaced": [
7472
"./dist/namespaced/index.d.mts",
7573
"./dist/namespaced/index.d.ts"
74+
],
75+
"constant": [
76+
"./dist/constant.d.mts",
77+
"./dist/constant.d.ts"
7678
]
7779
}
7880
},

packages/core/vite.config.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { execSync } from 'node:child_process'
12
import { resolve } from 'node:path'
23
import vue from '@vitejs/plugin-vue'
34
import 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(/[/\\]src[/\\](.*?)[/\\]/)
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(/[/\\]src[/\\](.*?)[/\\]/)
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
})

packages/plugins/src/namespaced/generate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { Components } from '@oku-ui/primitives/constant'
1+
import type { Components } from '../../../core/src/constant'
22
import { writeFileSync } from 'node:fs'
3-
import { components } from '@oku-ui/primitives/constant'
3+
import { components } from '../../../core/src/constant'
44

55
const excludedComponent = ['primitive', 'visuallyHidden']
66
const filteredComponent = Object.keys(components).filter(i => !excludedComponent.includes(i)) as Components[]

0 commit comments

Comments
 (0)