Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit bddf79c

Browse files
author
Stanislav Panferov
committed
feat(*): add sourceRoot support
1 parent 958a7a6 commit bddf79c

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
"grunt-shell": "^1.1.2",
4949
"grunt-ts": "^3.0.0",
5050
"load-grunt-tasks": "^0.6.0",
51-
"typescript": "^1.8.0-dev.20151119"
51+
"typescript": "^1.8.0-dev.20151123"
5252
}
5353
}

src/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require('babel-polyfill');
66

77
import * as Promise from 'bluebird';
88
import * as _ from 'lodash';
9+
import * as path from 'path';
910

1011
import { ICompilerOptions } from './host';
1112
import { createResolver } from './deps';
@@ -154,7 +155,12 @@ async function compiler(webpack: IWebPack, text: string): Promise<void> {
154155
let resultSourceMap = transformation.map;
155156

156157
if (resultSourceMap) {
157-
resultSourceMap.sources = [ fileName ];
158+
let sourcePath = path.relative(
159+
instance.options.sourceRoot,
160+
loaderUtils.getRemainingRequest(webpack)
161+
);
162+
163+
resultSourceMap.sources = [ sourcePath ];
158164
resultSourceMap.file = fileName;
159165
resultSourceMap.sourcesContent = [ text ];
160166
}

src/instance.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ export function ensureInstance(webpack: IWebPack, options: ICompilerOptions, ins
152152
doTypeCheck: true,
153153
sourceMap: true,
154154
verbose: false,
155-
noLib: false
155+
noLib: false,
156+
sourceRoot: process.cwd()
156157
});
157158

158159
options = _.omit(options, 'outDir') as any;

0 commit comments

Comments
 (0)