Im having problems bundling up my react app in a grunt-task, the app is written in in Typescript with *.tsx-files. For in-browser Typescript on the fly-compile works well. The components get loaded via system as *.tsx-files and compiled to javascript and run. In-Browser trigger:
<script> System.import("app/Main"); </script>
works finde ... But when i try to create a bundleSFX i get a lot errors related to TSX.
Grunt-Bundle command:
jspm.bundleSFX('app/Main', 'dist/build.js', {
minify: true,
mangle: true,
lowResSourceMaps: true,
sourceMaps: false
}).then(function () {
...
throws:
MultipleErrors: app/FilterButton.tsx:3:50: Unexpected token <
System.Config.js:
// ... defaults here
transpiler: "typescript",
typescriptOptions: {
"noImplicitAny": false,
"typeCheck": true,
"jsx": 2, // << was important to get TSX working (in browser)
"module": "system",
"isolatedModules": false,
"emitDecoratorMetadata": true,
"declaration": false,
"suppressImplicitAnyIndexErrors": true
}
// ... defaults here
packages: {
"app": {
"defaultExtension": "tsx",
"map": {
"typescript": "typescript"
},
"modules": {
"*.tsx": {
"loader": "typescript"
}
}
}
}
map: {
// ... JSPM installs here
}
the "jsx": 2
flag works fine see here:
https://github.com/Microsoft/TypeScript/issues/5918
What am i missing here ... , and why does it work in browser without errors ?