首页 文章

angular2 - 找不到浏览器,corejs

提问于
浏览
1

根据这个thread,我包括用于在angular2中创建模态的ng2-bs3-modal . 由于ng2-bs3-modal和它加载的js文件(如modal.js,modal-header.js)默认情况下不会将.js作为其扩展名,因此我必须使用deafultJsExtension:true来实现它 . 为了防止角度错误根据同一个线程(角度在浏览器中再次加载其模块),我在加载systemjs后直接包含system.config,而不是在加载angularjs后写入,

<script src="node_modules/es6-shim/es6-shim.min.js">
    </script>
    <script src="node_modules/systemjs/dist/system-polyfills.js">
    </script>
    <script src="node_modules/systemjs/dist/system.src.js">
    </script>
    <!-- 2. Configure SystemJS -->
    <script>
        System.config({
          defaultJSExtensions: true,
          packages: {
            angular: { defaultExtension: false },
            app: {
              format: 'register',
              defaultExtension: 'js'
            },
          },
          map: {
              'ng2-bs3-modal': 'node_modules/ng2-bs3-modal',
          }
        });
        System.import('node_modules/jquery/dist/jquery.min.js')
        System.import('node_modules/bootstrap/dist/js/bootstrap.min.js');
        System.import('app/js/main')
        .then(null, console.error.bind(console));
    </script>
    <script src="node_modules/angular2/bundles/angular2-polyfills.js">
    </script>
    <script src="node_modules/rxjs/bundles/Rx.js">
    </script>
    <script src="node_modules/angular2/bundles/angular2.dev.js">
    </script>

现在,有时它工作正常,有时它表示找不到browser.js,core.js,也就是system.js错误

(在控制台中它说GET http://localhost:3000/angular2/core.js 404(未找到) - system.src.js:1068断言失败:加载或加载 - system.src.js:291

有人可以识别这个谢谢

1 回答

  • 0

    好的,所以答案很明显,从错误,我不得不写一个angular2的 Map :: -

    map: {
           'ng2-bs3-modal': 'node_modules/ng2-bs3-modal',
           'angular2': 'node_modules/angular2'
         }
    

    也许这与文件序列和polyfill脚本加载有关,但这个序列取自我在互联网上阅读的来源,而且没有写到我们可能会遇到这样的错误 .

    每个人都在发生这种事吗?或者只是我

相关问题