- Remove the
localEnabled
and prodEnabled
configuration and use the enable
configuration instead, no longer distinguishing the environment
- Remove the
injectFile
、injectCode
and supportTs
configuration
- Minimum requirement NodeJs 16
- Production Environment Syntax Changes
// vite-plugin-mock/es/createProdMockServer => vite-plugin-mock/client
import { createProdMockServer } from 'vite-plugin-mock/client'
import roleMock from '../mock/dep/role'
// functional form
import userMockFn from '../mock/user'
export async function setupProdMockServer() {
const mockModules = [...roleMock, ...userMockFn()]
createProdMockServer(mockModules)
}
- Upgrade all dependencies to latest
- support
vite4
and rollup3
- The function module supports returning a function
import type { MockConfig } from 'vite-plugin-mock'
export default (config?: MockConfig) => {
return [
{
url: '/api/createUser',
method: 'post',
response: ({ body, query }) => {
console.log('body>>>>>>>>', body)
console.log('query>>>>>>>>', query)
return {
code: 0,
message: 'ok',
data: { a: 21, 'import.meta.url': import.meta.url },
}
},
},
]
}
- prod: response 在 prod 模式下入参对象加上 url (#83) (cd0b86f)
- server: add this for response, rawResponse function (#43) (2f4d6d2)
- prod: response 在 prod 模式下入参对象加上 url (#83) (cd0b86f)
- server: add this for response, rawResponse function (#43) (2f4d6d2)
- remove supportTs, change to automatic judgment (4625e59)
- response return url (#27) (de9ed27)
- server: add this for response, rawResponse function (#43) (2f4d6d2)
- remove supportTs, change to automatic judgment (4625e59)
- response return url (#27) (de9ed27)
- server: add this for response, rawResponse function (#43) (2f4d6d2)
- ensure that the post with parameters are matched,fix #29 (4cb55f8)
- fix js parsing error (1dbee45)
- improve path matching logic, fix #25 (5079e4b)
- loss request headers in PROD mode (#23) (76302df), closes #15
- make sure ignore matches the file correctly (b612a09)
- support node12 (fdfed60)
- remove supportTs, change to automatic judgment (4625e59)
- response return url (#27) (de9ed27)
- ensure file changes take effect,fix #36 (353aa9d)
- ensure that the post with parameters are matched,fix #29 (4cb55f8)
- fix js parsing error (1dbee45)
- improve path matching logic, fix #25 (5079e4b)
- loss request headers in PROD mode (#23) (76302df), closes #15
- make sure ignore matches the file correctly (b612a09)
- support node12 (fdfed60)
- remove supportTs, change to automatic judgment (4625e59)
- response return url (#27) (de9ed27)
- ensure that the post with parameters are matched,fix #29 (4cb55f8)
- fix js parsing error (d2746b6)
- improve path matching logic, fix #25 (5079e4b)
- loss request headers in PROD mode (#23) (76302df), closes #15
- make sure ignore matches the file correctly (b612a09)
- support node12 (fdfed60)
- remove supportTs, change to automatic judgment (4625e59)
- response return url (#27) (de9ed27)
- ensure that the post with parameters are matched,fix #29 (4cb55f8)
- improve path matching logic, fix #25 (5079e4b)
- loss request headers in PROD mode (#23) (76302df), closes #15
- make sure ignore matches the file correctly (b612a09)
- support node12 (fdfed60)
- remove supportTs, change to automatic judgment (4625e59)
- response return url (#27) (de9ed27)
- ensure that the post with parameters are matched,fix #29 (bfed256)
- improve path matching logic, fix #25 (5079e4b)
- loss request headers in PROD mode (#23) (76302df), closes #15
- make sure ignore matches the file correctly (b612a09)
- support node12 (fdfed60)
- remove supportTs, change to automatic judgment (a341c7d)
- response return url (#27) (de9ed27)
- improve path matching logic, fix #25 (5079e4b)
- loss request headers in PROD mode (#23) (76302df), closes #15
- make sure ignore matches the file correctly (b612a09)
- support node12 (fdfed60)
- production xhr (6c94783)
- eslint warn: fix some warn (b44c13b)
- empty TS file in mock folder is error (669b804)
- empty TS file in mock folder is error (669b804)
- ensure that the URLs of different request methods cannot match close #6 (361a3eb)
- Fix local development post request proxy to https (7965604)
- remove unnecessary and wrong usage of "try catch" (815abde)
- add supportTs options,Support es6 and commonjs modules in .js folder (37f83f5)
- Replace typescript plug-in with a faster esbuild plug-in (58ad7cd)