Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.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
Firefox TypeScript/Angular2:tagDef.requireExtraParent不是函数_Firefox_Typescript_Angular_Transpiler_Es6 Shim - Fatal编程技术网

Firefox TypeScript/Angular2:tagDef.requireExtraParent不是函数

Firefox TypeScript/Angular2:tagDef.requireExtraParent不是函数,firefox,typescript,angular,transpiler,es6-shim,Firefox,Typescript,Angular,Transpiler,Es6 Shim,研究错误 <script> System.config({ transpiler: 'typescript', typescriptOptions: { emitDecoratorMetadata: true }, packages: { 'js': { defaultExtension: 'js' } } }); System.import('js/main')

研究错误

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
“异常:类型错误:tagDef.requireExtraParent不是函数”

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
它实际上在谷歌上返回0个结果

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
背景:

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
  • 网站在Chrome和Safari上运行良好。我还没有测试过IE。整个噩梦就在那里
  • 错误仅适用于Firefox(似乎是所有版本,但目前为45)
  • 我正在使用系统从TypeScript转换到ES5,下面是Angular quickstart
  • 在mac电脑上,如果这很重要的话
  • 角度2,β9
该网站是非常基本的。我已经排除了所有可能的复杂因素,似乎错误只是在引导本身。也许是少了一个polyfill

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
index.html

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
我试过什么

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
添加一些额外的多边形填充,比如html_解析器,它似乎是定义requireExtraParent方法的地方

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
<script type="text/javascript" src="dist/lib/html_parser.js"></script>

消除任何编译/传输错误

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));

挖得太深,谷歌甚至找不到任何东西。

你的解决方案是spoton

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));
<script type="text/javascript" src="dist/lib/html_parser.js"></script>

问题是我在Angular中使用了一个保留字作为标记(watch)

<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 
    packages: {
        'js': {
            defaultExtension: 'js'
        }
    } 
  });
  System.import('js/main')
        .then(null, console.error.bind(console));


这样做之后错误仍然存在,但是。。。?SyntaxError:导入声明只能出现在模块的顶层