Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2d095b0

Browse files
authored
Merge pull request vue-zone#24 from leo4developer/main
fix(dev): 🐛 fixed `mock` value judgments (vue-zone#24)
2 parents 7a3b38c + beb29b6 commit 2d095b0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎vite.config.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import mock from './build/mock/createMockServer'
2020
export default ({ command, mode }: ConfigEnv): UserConfig => {
2121
const root = process.cwd()
2222
const env = loadEnv(mode, root)
23-
23+
const isHttpMock = env.VITE_HTTP_MOCK === 'true'
24+
const isViteMock = env.VITE_MOCK === 'true'
2425
return {
2526
base: env.VITE_APP_PUBLIC_PATH,
2627

@@ -72,7 +73,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
7273
watch: true,
7374
mockUrlList: [/api/],
7475
cwd: process.cwd(),
75-
enable: env.VITE_HTTP_MOCK && env.VITE_MOCK && process.env.NODE_ENV !== 'production',
76+
enable: isHttpMock && isViteMock && process.env.NODE_ENV !== 'production',
7677
}),
7778
],
7879

@@ -103,7 +104,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
103104
server: {
104105
host: true,
105106
port: 3000,
106-
proxy: env.VITE_HTTP_MOCK && env.VITE_MOCK && process.env.NODE_ENV !== 'production'
107+
proxy: isHttpMock && isViteMock && process.env.NODE_ENV !== 'production'
107108
? undefined
108109
: {
109110
'/api': {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /