Skip to content

use empty string when sourceMapText is undefined #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 14, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/compilers/typescript-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ module.exports = function compileTypescript (scriptContent) {
const tsConfig = getTypescriptConfig()

const res = typescript.transpileModule(scriptContent, tsConfig)
const inputSourceMap = (res.sourceMapText !== undefined)
? JSON.parse(res.sourceMapText)
: ''

// handle ES modules in TS source code in case user uses non commonjs module
// output and there is no .babelrc.
Expand All @@ -64,5 +67,5 @@ module.exports = function compileTypescript (scriptContent) {
}
}

return compileBabel(res.outputText, JSON.parse(res.sourceMapText), inlineBabelConfig)
return compileBabel(res.outputText, inputSourceMap, inlineBabelConfig)
}