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

Commit

Permalink
Parse only existing sourceMapText
Browse files Browse the repository at this point in the history
  • Loading branch information
Chadkin committed Aug 5, 2016
1 parent 954ccce commit 7eaf8c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
};
Expand Down
7 changes: 7 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 7eaf8c8

Please sign in to comment.