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

Commit 1117837

Browse files
committed
refactor(optimization): generate source-map correctly from modified code
generate source-map correctly from modified code
1 parent b626e00 commit 1117837

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/optimization.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { extname } from 'path';
1+
import { basename, extname } from 'path';
22

33
import * as MagicString from 'magic-string';
44

@@ -84,7 +84,13 @@ function removeDecorators(context: BuildContext) {
8484
let magicString = new MagicString(jsFile.content);
8585
magicString = purgeStaticFieldDecorators(jsFile.path, jsFile.content, getStringPropertyValue(Constants.ENV_VAR_IONIC_ANGULAR_DIR), getStringPropertyValue(Constants.ENV_VAR_AT_ANGULAR_DIR), context.srcDir, magicString);
8686
jsFile.content = magicString.toString();
87-
// jsFile.content = removeTSickleClosureDeclarations(jsFile.path, jsFile.content, getStringPropertyValue(Constants.ENV_VAR_IONIC_ANGULAR_DIR), context.srcDir);
87+
const sourceMap = magicString.generateMap({
88+
source: basename(jsFile.path),
89+
file: basename(jsFile.path),
90+
includeContent: true
91+
});
92+
const sourceMapPath = jsFile.path + '.map';
93+
context.fileCache.set(sourceMapPath, { path: sourceMapPath, content: sourceMap.toString()});
8894
});
8995
}
9096

0 commit comments

Comments
 (0)