diff --git a/src/index.js b/src/index.js index 2fe930c..91a3830 100644 --- a/src/index.js +++ b/src/index.js @@ -219,7 +219,7 @@ export default function typescript ( options ) { `\nimport { __assign, __awaiter, __extends, __decorate, __metadata, __param } from 'typescript-helpers';`, // Rollup expects `map` to be an object so we must parse the string - map: JSON.parse(transformed.sourceMapText) + map: transformed.sourceMapText ? JSON.parse(transformed.sourceMapText) : null }; } }; diff --git a/test/test.js b/test/test.js index 585d10d..c44e1b5 100644 --- a/test/test.js +++ b/test/test.js @@ -201,6 +201,13 @@ describe( 'rollup-plugin-typescript', function () { inlineSourceMap: true, }); }); + + it ( 'should not fail if source maps are off', function () { + return bundle( 'sample/overriding-typescript/main.ts', { + inlineSourceMap: false, + sourceMap: false + }); + }); }); function fakeTypescript( custom ) {