You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 文件路径 @/src/mockProdServer.ts// eslint-disable-next-line @typescript-eslint/ban-ts-comment// @ts-expect-errorimport{createProdMockServer}from'vite-plugin-mock/client'constmodules: {[key: string]: {default: object[]}}=import.meta.glob('../mock/*.mock.ts',{eager: true})constmockModules: object[]=[]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 */exportfunctionsetupProdMockServer(){createProdMockServer(mockModules)console.log(mockModules)}
我在开发环境能正常使用,但是打包到生产环境后就出问题了
版本
vite.config.js 配置
mocker 接口配置
mockProdServer.ts配置
main.js 中引用
打包后在生产环境无法正常mock
The text was updated successfully, but these errors were encountered: