-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'; | ||
import userMock from './sys/user'; | ||
import menuMock from './sys/menu'; | ||
import tableDemoMock from './demo/table-demo'; | ||
import accountDemoMock from './demo/account'; | ||
import selectDemoMock from './demo/select-demo'; | ||
|
||
const modules = import.meta.globEager('./**/*.ts'); | ||
|
||
const mockModules: any[] = []; | ||
Object.keys(modules).forEach((key) => { | ||
if (key.includes('/_')) { | ||
return; | ||
} | ||
mockModules.push(...modules[key].default); | ||
}); | ||
|
||
/** | ||
* Used in a production environment. Need to manually import all modules | ||
*/ | ||
export function setupProdMockServer() { | ||
createProdMockServer([ | ||
...userMock, | ||
...menuMock, | ||
...tableDemoMock, | ||
...accountDemoMock, | ||
...selectDemoMock, | ||
]); | ||
createProdMockServer(mockModules); | ||
} |
df6b5e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同步