Angular 2 - 404 traceur not found

后端 未结 17 3146
故里飘歌
故里飘歌 2020-12-03 02:34

I\'ve followed the starting guide and expanded a little upon for a previous angular 2 version. I\'ve updated my revision and changed everything accordingly. When I am runnin

17条回答
  •  旧时难觅i
    2020-12-03 03:06

    There are multiple reason behind this error,

    1)Sometimes comments mentioned on top of app.component.ts file
    2)pointing to incorrect umd file
    3)If you are using ts(Typescript) version, please mention the transpiler options in config.js file as below or compile your all .ts file to .js file using transpiler and then reference .js file in code:

    (function (global) {
        System.config({
            transpiler: 'ts',
            typescriptOptions: {
              tsconfig: true
            },
            paths: {
                // paths serve as alias
                'npm:': 'node_modules/'
            },
            // map tells the System loader where to look for things
            map: {
                // our app is within the app folder
                app: 'app',
                // angular bundles
                '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
                '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
                '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
                '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
                '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
                '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
                '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
                '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
                // other libraries
                'rxjs': 'npm:rxjs',
                'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
                'angular2' : ''
            },
            // packages tells the System loader how to load when no filename and/or no extension
            packages: {
                app: {
                    main: './main',
                    defaultExtension: 'ts'
                },
                rxjs: {
                    defaultExtension: 'js'
                },
                'angular-in-memory-web-api': {
                    main: './index.js',
                    defaultExtension: 'js'
                }
            }
        });
    })(this);
    

提交回复
热议问题