File tree Expand file tree Collapse file tree 3 files changed +31
-15
lines changed
Expand file tree Collapse file tree 3 files changed +31
-15
lines changed Original file line number Diff line number Diff line change 2323 " README.md"
2424 ],
2525 "scripts" : {
26- "build" : " vite build && tsdown " ,
26+ "build" : " vite build" ,
2727 "sync" : " curl -X PUT \" https://registry-direct.npmmirror.com/-/package/@candriajs/lodash/syncs\" "
2828 },
2929 "engines" : {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import { defineConfig } from 'vite'
22import { builtinModules } from 'node:module'
3+ import fs from 'node:fs'
4+ import path from 'node:path'
35
46export default defineConfig ( {
57 build : {
@@ -28,5 +30,33 @@ export default defineConfig({
2830 transformMixedEsModules : true ,
2931 defaultIsModuleExports : true
3032 } ,
33+ } ,
34+ plugins : [
35+ {
36+ name : 'lodash-plugin' ,
37+ closeBundle ( ) {
38+ const sourceDir = './node_modules/@types/lodash'
39+ const targetDir = './dist/types'
40+
41+ const copyRecursiveSync = ( src : string , dest : string ) => {
42+ const stat = fs . statSync ( src )
43+
44+ if ( stat . isDirectory ( ) ) {
45+ fs . mkdirSync ( dest , { recursive : true } )
46+ fs . readdirSync ( src ) . forEach ( item => {
47+ copyRecursiveSync (
48+ path . join ( src , item ) ,
49+ path . join ( dest , item )
50+ )
51+ } )
52+ } else {
53+ fs . copyFileSync ( src , dest )
54+ }
3155 }
56+
57+ copyRecursiveSync ( sourceDir , targetDir )
58+ console . log ( '构建 lodash 成功!' )
59+ }
60+ }
61+ ]
3262} )
You can’t perform that action at this time.
0 commit comments