File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ $ babel --plugins transform-n4js-systemjs-commonjs ...
2626Plugin Options:
2727- ` verbose: [string] ` switches on verbose logging of the used module IDs
2828- ` stripPackageID_re: [string|Regexp] ` regex to rewrite/strip parts of the package ID by convention
29+ - ` noSourceMap: [boolean] ` whether the N4JS source-map reference should be dropped; defaults to ` true `
2930
3031## License
3132
Original file line number Diff line number Diff line change @@ -91,8 +91,12 @@ module.exports = ({types: t}) => {
9191 let program = path . node ,
9292 opts = state . opts || { } ,
9393 verbose = opts . verbose ,
94- stripPackageID_re = opts . stripPackageID_re ;
94+ stripPackageID_re = opts . stripPackageID_re ,
95+ noSourceMap = opts . noSourceMap ;
9596
97+ if ( typeof noSourceMap === "undefined" ) {
98+ noSourceMap = true ;
99+ }
96100 if ( stripPackageID_re && ! ( stripPackageID_re instanceof RegExp ) ) {
97101 stripPackageID_re = new RegExp ( stripPackageID_re ) ;
98102 }
@@ -124,12 +128,14 @@ module.exports = ({types: t}) => {
124128 sysRegExpr . arguments . push ( t . stringLiteral ( getModuleIdOf ( filename , verbose ) ) ) ;
125129 }
126130
127- let comments = path . container . comments ;
128- comments . forEach ( c => {
129- if ( c . value . startsWith ( "# sourceMappingURL=" ) ) {
130- c . value = `--${ c . value } --` ;
131- }
132- } ) ;
131+ if ( noSourceMap ) {
132+ let comments = path . container . comments ;
133+ comments . forEach ( c => {
134+ if ( c . value . startsWith ( "# sourceMappingURL=" ) ) {
135+ c . value = `--${ c . value } --` ;
136+ }
137+ } ) ;
138+ }
133139
134140 // replace all System._nodeRequire calls
135141 path . traverse ( _nodeRequireVisitor ) ;
You can’t perform that action at this time.
0 commit comments