Skip to content

Commit

Permalink
fix: generate sourcemap (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaobos committed May 29, 2023
1 parent fd69c8a commit fffa20e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ ${dts}`.trim()}\n`

return {
code: s.toString(),
map: s.generateMap({ source: id, includeContent: true }),
map: s.generateMap({ source: id, includeContent: true, hires: options.sourcemapHires }),
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ export interface Options {
* Generate corresponding .eslintrc-auto-import.json file.
*/
eslintrc?: ESLintrc

/**
* https://github.com/antfu/unplugin-auto-import/issues/382
* Whether the mapping should be high-resolution.
* Hi-res mappings map every single character, meaning (for example) your devtools will always
* be able to pinpoint the exact location of function calls and so on.
* With lo-res mappings, devtools may only be able to identify the correct
* line - but they're quicker to generate and less bulky.
*/
sourcemapHires?: boolean
}

export { PresetName }

0 comments on commit fffa20e

Please sign in to comment.