Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): provide Vite client code source m…
Browse files Browse the repository at this point in the history
…ap when loading

The sourcemap for the Vite client code was previously not being loaded along with the
actual code. This could lead to browser 404 console messages when debugging applications.

(cherry picked from commit e98dde6)
  • Loading branch information
clydin authored and dgp1130 committed Feb 22, 2024
1 parent 9e7c47b commit f2a2e92
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ export function createAngularMemoryPlugin(options: AngularMemoryPluginOptions):
return join(virtualProjectRoot, source);
}
},
load(id) {
async load(id) {
const [file] = id.split('?', 1);
const relativeFile = '/' + normalizePath(relative(virtualProjectRoot, file));
const codeContents = outputFiles.get(relativeFile)?.contents;
if (codeContents === undefined) {
if (relativeFile.endsWith('/node_modules/vite/dist/client/client.mjs')) {
return loadViteClientCode(file);
return {
code: await loadViteClientCode(file),
map: await readFile(file + '.map', 'utf-8'),
};
}

return;
Expand Down

0 comments on commit f2a2e92

Please sign in to comment.