-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(projects): add prod mockjs switch [添加生产模式的mockjs的开关]
- Loading branch information
1 parent
9b19f96
commit 9f5638f
Showing
7 changed files
with
337 additions
and
362 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 |
---|---|---|
|
@@ -6,3 +6,5 @@ VITE_COMPRESS=N | |
VITE_COMPRESS_TYPE=gzip | ||
|
||
VITE_PWA=N | ||
|
||
VITE_PROD_MOCK=Y |
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,9 +1,14 @@ | ||
import { viteMockServe } from 'vite-plugin-mock'; | ||
|
||
export default viteMockServe({ | ||
mockPath: 'mock', | ||
injectCode: ` | ||
import { setupMockServer } from '../mock'; | ||
setupMockServer(); | ||
` | ||
}); | ||
export default (viteEnv: ImportMetaEnv) => { | ||
const prodMock = viteEnv.VITE_PROD_MOCK === 'Y'; | ||
|
||
return viteMockServe({ | ||
mockPath: 'mock', | ||
prodEnabled: prodMock, | ||
injectCode: ` | ||
import { setupMockServer } from '../mock'; | ||
setupMockServer(); | ||
` | ||
}); | ||
}; |
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.
9f5638f
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.
Successfully deployed to the following URLs:
soybean-admin – ./
soybean-admin-git-main-soybeanjs.vercel.app
soybean-admin-eta.vercel.app
admin.soybeanjs.cn
soybean-admin-soybeanjs.vercel.app