Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法将systemjs添加到我的typescript项目中_Javascript_Typescript_Systemjs - Fatal编程技术网

Javascript 无法将systemjs添加到我的typescript项目中

Javascript 无法将systemjs添加到我的typescript项目中,javascript,typescript,systemjs,Javascript,Typescript,Systemjs,我有一个现有的typescript项目,现在我想使用其中的一些库。它被配置为生成一个输出文件,因此我需要设置模块:“System”,我已经这样做了。此外,我还在index.html中添加了systemJS。但是有一个巨大的问题——每当我尝试导入我的js文件时,使用systemjs它工作得很好——我可以使用其中声明的所有函数,等等。但是,当我将任何导入包括到文件中时(例如从“someconst”导入{A}),systemjs将停止处理大量错误消息 Uncaught ReferenceError:

我有一个现有的typescript项目,现在我想使用其中的一些库。它被配置为生成一个输出文件,因此我需要设置模块:“System”,我已经这样做了。此外,我还在index.html中添加了systemJS。但是有一个巨大的问题——每当我尝试导入我的js文件时,使用systemjs它工作得很好——我可以使用其中声明的所有函数,等等。但是,当我将任何导入包括到文件中时(例如从“someconst”导入{A}),systemjs将停止处理大量错误消息

Uncaught ReferenceError: System is not defined
Uncaught (in promise) TypeError: hello.init is not a function
Uncaught TypeError: Cannot read property 'apply' of null
    at window.onerror (common.js:143)
以下是我如何在index.html中添加systemjs:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.1/system.js" integrity="sha512-7srDmqummlvkixi8/FhTwAQCedVevJFHf9toA+c7CuCuP3dQxVhP7hPm05hkbGDHyDbwWdLCEg/AhO21Wb375Q==" crossorigin="anonymous">
</script>

<script>
    System.import('js/map.js').then(function (hello) {
        hello.init();
        console.log(hello)
    });

</script>
用于测试导入的My sometext.js:

export const A = "AAABBBCCC"
还有我的tsconfig:

{
  "compileOnSave": true,

  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "module": "System",
    "target": "es5",
    "outFile": "../../wwwroot/js/map.js"
  },


  "exclude": [
  ]
}
我做错了什么?看起来systemjs工作得很好,但当我导入任何东西时,它就会崩溃

{
  "compileOnSave": true,

  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "module": "System",
    "target": "es5",
    "outFile": "../../wwwroot/js/map.js"
  },


  "exclude": [
  ]
}