Skip to content

Commit

Permalink
Revert "fix: lazily evaluate __vite__mapDeps files (vitejs#17602)"
Browse files Browse the repository at this point in the history
This reverts commit dafff4a.
  • Loading branch information
krish9797 committed Sep 23, 2024
1 parent 2883fb5 commit 5c02ef5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/importAnalysisBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
)
.join(',')}]`

const mapDepsCode = `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=${fileDepsCode})))=>i.map(i=>d[i]);\n`
const mapDepsCode = `const __vite__fileDeps=${fileDepsCode},__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);\n`

// inject extra code at the top or next line of hashbang
if (code.startsWith('#!')) {
Expand Down
2 changes: 1 addition & 1 deletion playground/js-sourcemap/__tests__/js-sourcemap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe.runIf(isBuild)('build tests', () => {
const js = findAssetFile(/after-preload-dynamic-hashbang-[-\w]{8}\.js$/)
expect(js.split('\n').slice(0, 2)).toEqual([
'#!/usr/bin/env node',
expect.stringContaining('const __vite__mapDeps=(i'),
expect.stringContaining('const __vite__fileDeps=['),
])
})

Expand Down

0 comments on commit 5c02ef5

Please sign in to comment.