-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use environment API to build (#23)
- Loading branch information
1 parent
a645e60
commit df12da2
Showing
7 changed files
with
130 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
import type { RsbuildInstance } from '@rsbuild/core'; | ||
import type { BuildOptions } from './cli/commands'; | ||
import { initRsbuild } from './config'; | ||
import type { RslibConfig } from './types/config'; | ||
|
||
export async function build(config: RslibConfig, options?: BuildOptions) { | ||
const rsbuildInstances = await initRsbuild(config); | ||
const rsbuildInstance = await initRsbuild(config); | ||
|
||
const buildPromises = rsbuildInstances.map( | ||
async (rsbuildInstance: RsbuildInstance) => { | ||
return await rsbuildInstance.build({ | ||
mode: 'production', | ||
watch: options?.watch, | ||
}); | ||
}, | ||
); | ||
await rsbuildInstance.build({ | ||
mode: 'production', | ||
watch: options?.watch, | ||
}); | ||
|
||
await Promise.all(buildPromises); | ||
|
||
return rsbuildInstances; | ||
return rsbuildInstance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.