Skip to content

Commit 6d03c22

Browse files
fix some files not copying when building
1 parent 5b3fdb8 commit 6d03c22

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

vite.config.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { defineConfig } from 'vite'
2+
import { copyFileSync, mkdirSync } from 'fs'
3+
import { join } from 'path'
24

35
export default defineConfig({
46
root: './src',
@@ -14,6 +16,19 @@ export default defineConfig({
1416
output: {
1517
manualChunks: undefined
1618
}
19+
},
20+
copyPublicDir: false // We'll handle copying manually
21+
},
22+
publicDir: './assets',
23+
plugins: [
24+
{
25+
name: 'copy-assets',
26+
writeBundle() {
27+
// Create assets directory in dist
28+
mkdirSync('dist/assets', { recursive: true })
29+
// Copy miao.txt to assets folder
30+
copyFileSync('src/assets/miao.txt', 'dist/assets/miao.txt')
31+
}
1732
}
18-
}
33+
]
1934
})

0 commit comments

Comments
 (0)