I have this SystemJS configuration in index.html:
<body>
<script src="node_modules/systemjs/dist/system.js"></script>
<script>
System.config({
defaultJSExtensions: true,
transpiler: 'typescript',
map: {
typescript: 'node_modules/typescript/lib/typescript.js'
},
packages: {
"ts": {
"defaultExtension": "ts"
}
},
});
System.import('ts/main');
</script>
</body>
main.ts:
let a = [1, 2, 3];
let b = [1, 2, 3];
I get: Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
. It looks like the file is not overloaded by SystemJS.
When I add an import statement in the first line, it works fine:
import * as ts from 'typescript';
let a = [1, 2, 3];
let b = [1, 2, 3];
It seems that SystemJS recognizes the typescript file by its “content” - is that right? If so, how to make it overlap every .ts or src / file?
source
share