Created
November 3, 2015 16:50
-
-
Save diverted247/a6f7f68fe03939cdc563 to your computer and use it in GitHub Desktop.
Vueify Configuration for TypeScript v0.0.1 (Early)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ts = require("typescript"); | |
module.exports = { | |
// register custom compilers | |
customCompilers: { | |
// for tags with lang="ts" | |
ts: function( content , cb ){ | |
var compilerOptions = { module: ts.ModuleKind.CommonJS }; | |
var res = ts.transpileModule( content , { compilerOptions: compilerOptions , moduleName: "" , reportDiagnostics: true } ); | |
if( res.diagnostics.length == 0 ){ | |
cb( null , res.outputText ) | |
} else { | |
var err = ""; | |
var arrayLength = res.diagnostics.length; | |
for( var i = 0; i < arrayLength; i++ ) { | |
err += res.diagnostics[i].file.fileName + ": error TS" + res.diagnostics[i].code + ': ' + res.diagnostics[i].messageText + "\n"; | |
} | |
return cb( err ) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment