99
1010import { rimraf } from 'rimraf'
1111import { tsc } from '@athenna/tsconfig/tsc'
12+ import { Path , Color } from '@athenna/common'
1213import { isAbsolute , join , parse } from 'node:path'
13- import { Path , Color , Module } from '@athenna/common'
1414import { BaseCommand , Option } from '@athenna/artisan'
1515import { copyfiles } from '@athenna/tsconfig/copyfiles'
1616import { UndefinedOutDirException } from '#src/exceptions/UndefinedOutDirException'
@@ -61,15 +61,8 @@ export class BuildCommand extends BaseCommand {
6161 ( ) => tsc ( tsConfigPath )
6262 )
6363
64- if ( include . length ) {
65- tasks . addPromise (
66- `Copying included paths to ${ outDirName } folder: ${ includedPaths } ` ,
67- ( ) => copyfiles ( include , outDir )
68- )
69- }
70-
7164 if ( this . vite ) {
72- const vite = this . getVite ( )
65+ const vite = await this . getVite ( )
7366
7467 tasks . addPromise (
7568 `Compiling static files using ${ Color . yellow . bold ( 'vite' ) } ` ,
@@ -81,6 +74,13 @@ export class BuildCommand extends BaseCommand {
8174 )
8275 }
8376
77+ if ( include . length ) {
78+ tasks . addPromise (
79+ `Copying included paths to ${ outDirName } folder: ${ includedPaths } ` ,
80+ ( ) => copyfiles ( include , outDir )
81+ )
82+ }
83+
8484 await tasks . run ( )
8585
8686 console . log ( )
@@ -105,10 +105,8 @@ export class BuildCommand extends BaseCommand {
105105 return Path . pwd ( Config . get ( 'rc.commands.build.outDir' ) )
106106 }
107107
108- public getVite ( ) {
109- const require = Module . createRequire ( import . meta. url )
110-
111- return require ( 'vite' )
108+ public async getVite ( ) {
109+ return import ( 'vite' )
112110 }
113111
114112 public async getViteConfig ( vite : any ) {
0 commit comments