Skip to content

Commit

Permalink
perf: improve build output
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed Aug 10, 2024
1 parent e66f70c commit 98e54a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ async function generateMockEntryCode(
// fix: #21
const file = normalizePath(path.join(cwd, filepath))
importers += `import * as m${index} from '${file}';\n`
exporters.push(`[m${index}, filepath]`)
exporters.push(`[m${index}, '${filepath}']`)
})
return `import { transformMockData, transformRawData } from 'vite-plugin-mock-dev-server';
${importers}
const exporters = [\n ${exporters.join(',\n ')}\n];
const mockList = exporters.map(([mod, filepath]) => {
const raw = mod.default || mod
return transformRawData(raw, filepath)
const raw = mod.default || mod;
return transformRawData(raw, filepath);
});
export default transformMockData(mockList);`
}

0 comments on commit 98e54a7

Please sign in to comment.