Skip to content

Commit 2505a83

Browse files
committed
👕 refactor: sourcemap passing
1 parent 66a36fb commit 2505a83

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import webpack from 'webpack'
22
import { ParsedUrlQuery, parse } from 'querystring'
3+
import { RawSourceMap } from 'source-map'
34

4-
const loader: webpack.loader.Loader = function (source: string | Buffer): void {
5+
const loader: webpack.loader.Loader = function (
6+
source: string | Buffer, sourceMap: RawSourceMap | undefined): void {
57
if (this.version && Number(this.version) >= 2) {
68
try {
79
this.cacheable && this.cacheable()
8-
this.callback(null, `module.exports = ${generateCode(source, parse(this.resourceQuery))}`)
10+
this.callback(null, `module.exports = ${generateCode(source, parse(this.resourceQuery))}`, sourceMap)
911
} catch (err) {
1012
this.emitError(err.message)
1113
this.callback(err)

0 commit comments

Comments
 (0)