Skip to content

Commit

Permalink
feat: add optional global configuration of root directory (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
art0rz committed Jul 24, 2023
1 parent 7303538 commit e564641
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/configuration/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,11 @@ Shared configuration to control the checker behaviors of the plugin.
* @defaultValue `true`
*/
enableBuild: boolean

/**
* Configure root directory of checkers
* @defaultValue no default value
*/
root?: boolean;
}
```
2 changes: 1 addition & 1 deletion packages/vite-plugin-checker/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function checker(userConfig: UserPluginConfig): Plugin {
// Get the server instance and keep reference in a closure
checkers.forEach((checker, index) => {
const { worker, configureServer: workerConfigureServer } = checker.serve
workerConfigureServer({ root: server.config.root })
workerConfigureServer({ root: userConfig.root || server.config.root })
worker.on('message', (action: Action) => {
if (action.type === ACTION_TYPES.overlayError) {
latestOverlayErrors[index] = action.payload as ClientDiagnosticPayload
Expand Down
5 changes: 5 additions & 0 deletions packages/vite-plugin-checker/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ export interface SharedConfig {
* @defaultValue `true`
*/
enableBuild: boolean
/**
* Configure root directory of checkers
* @defaultValue no default value
*/
root?: string
}

export interface BuildInCheckers {
Expand Down

0 comments on commit e564641

Please sign in to comment.