Skip to content

Commit

Permalink
feat: sourcemap handling for deep imports
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 23, 2020
1 parent c11cfc8 commit b100683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/plugins/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const modulesPlugin: Plugin = ({ root, app }) => {
// assumes the `.js` and `.js.map` files to have the same prefix.
const sourceMapRequest = id
const jsRequest = sourceMapRequest.replace(/\.map$/, '')
const moduleId = fileToIdMap.get(jsRequest)
const moduleId = fileToIdMap.get(path.basename(jsRequest))
if (!moduleId) {
console.error(
`[vite] failed to infer original js file for source map request ` +
Expand All @@ -95,7 +95,7 @@ export const modulesPlugin: Plugin = ({ root, app }) => {
const modulePath = idToFileMap.get(moduleId)
const sourceMapPath = path.join(
path.dirname(modulePath),
sourceMapRequest
path.basename(sourceMapRequest)
)
idToFileMap.set(sourceMapRequest, sourceMapPath)
ctx.type = 'application/json'
Expand Down

0 comments on commit b100683

Please sign in to comment.