Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit 7eaf8c8

Browse files
author
Chadkin
committed
Parse only existing sourceMapText
1 parent 954ccce commit 7eaf8c8

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export default function typescript ( options ) {
219219
`\nimport { __assign, __awaiter, __extends, __decorate, __metadata, __param } from 'typescript-helpers';`,
220220

221221
// Rollup expects `map` to be an object so we must parse the string
222-
map: JSON.parse(transformed.sourceMapText)
222+
map: transformed.sourceMapText ? JSON.parse(transformed.sourceMapText) : null
223223
};
224224
}
225225
};

test/test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ describe( 'rollup-plugin-typescript', function () {
201201
inlineSourceMap: true,
202202
});
203203
});
204+
205+
it ( 'should not fail if source maps are off', function () {
206+
return bundle( 'sample/overriding-typescript/main.ts', {
207+
inlineSourceMap: false,
208+
sourceMap: false
209+
});
210+
});
204211
});
205212

206213
function fakeTypescript( custom ) {

0 commit comments

Comments
 (0)