1- import type { AssetPackConfig } from '@assetpack/core'
2- import type { Plugin , ResolvedConfig } from 'vite'
1+ // import type { AssetPackConfig } from '@assetpack/core'
2+ // import type { Plugin, ResolvedConfig } from 'vite'
33
4- import { AssetPack } from '@assetpack/core'
4+ // import { AssetPack } from '@assetpack/core'
55import generouted from '@generouted/react-router/plugin'
66import react from '@vitejs/plugin-react'
7- import { cwd } from 'node:process'
7+ // import { cwd } from 'node:process'
88import { defineConfig } from 'vite'
99import tsconfigPaths from 'vite-tsconfig-paths'
1010
11- import assetpackConfig from './assetpack.config'
11+ // import assetpackConfig from './assetpack.config'
1212
13- const assetpack = ( apConfig : AssetPackConfig ) : Plugin => {
14- let mode : ResolvedConfig [ 'command' ]
15- let ap : AssetPack | undefined
13+ // const assetpack = (apConfig: AssetPackConfig): Plugin => {
14+ // let mode: ResolvedConfig['command']
15+ // let ap: AssetPack | undefined
1616
17- return {
18- buildEnd : async ( ) => {
19- if ( ! ( ap ) )
20- return
21- await ap . stop ( )
22- ap = undefined
23- } ,
24- buildStart : async ( ) => {
25- if ( mode === 'serve' ) {
26- if ( ap )
27- return
28- ap = new AssetPack ( apConfig )
29- void ap . watch ( )
30- }
31- else {
32- await new AssetPack ( apConfig ) . run ( )
33- }
34- } ,
35- configResolved ( resolvedConfig ) {
36- mode = resolvedConfig . command
37- if ( ! resolvedConfig . publicDir )
38- return
39- if ( apConfig . output !== undefined )
40- return
41- const publicDir = resolvedConfig . publicDir . replace ( cwd ( ) , '' )
42- apConfig . output = `.${ publicDir } /assets/`
43- } ,
44- name : 'vite-plugin-assetpack' ,
45- }
46- }
17+ // return {
18+ // buildEnd: async () => {
19+ // if (!(ap))
20+ // return
21+ // await ap.stop()
22+ // ap = undefined
23+ // },
24+ // buildStart: async () => {
25+ // if (mode === 'serve') {
26+ // if (ap)
27+ // return
28+ // ap = new AssetPack(apConfig)
29+ // void ap.watch()
30+ // }
31+ // else {
32+ // await new AssetPack(apConfig).run()
33+ // }
34+ // },
35+ // configResolved(resolvedConfig) {
36+ // mode = resolvedConfig.command
37+ // if (!resolvedConfig.publicDir)
38+ // return
39+ // if (apConfig.output !== undefined)
40+ // return
41+ // const publicDir = resolvedConfig.publicDir.replace(cwd(), '')
42+ // apConfig.output = `.${publicDir}/assets/`
43+ // },
44+ // name: 'vite-plugin-assetpack',
45+ // }
46+ // }
4747
4848// https://vite.dev/config/
4949export default defineConfig ( ( { mode } ) => ( {
@@ -57,7 +57,7 @@ export default defineConfig(({ mode }) => ({
5757 } ) ,
5858 generouted ( ) ,
5959 tsconfigPaths ( ) ,
60- assetpack ( assetpackConfig ) ,
60+ // assetpack(assetpackConfig),
6161 ] ,
6262 publicDir : mode === 'development' ? 'public' : false ,
6363 // optimizeDeps: {
0 commit comments