Я пытаюсь использовать модульную систему с Es6 и SystemJ.
Это код моей библиотеки
export function sayHello( name ) {
return `Hello ${name}`;
};
И импортировать app.js.
import { sayHello } from './lib'
sayHello('Myname');
tscongig.json
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"target": "ES5",
"outDir": "built",
"rootDir": "src"
},
"include": [
"**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
package.json
{
...
"dependencies": {
"lite-server": "^2.4.0",
"systemjs": "^3.1.1"
}
}
index.html
<!DOCTYPE html>
<html>
<head><title>TypeScript Greeter</title></head>
<body>
<script src="/node_modules/systemjs/dist/system.min.js"></script>
<script>
System.import('/built/app.js').then(function(){
console.log('Done');
}, function(error){
console.log(error);
});
</script>
</body>
</html>
После запуска я вижу ошибку.
Uncaught ReferenceError: exports is not defined
Помогите пожалуйста, где найти ошибку?