Naresh
Naresh

Reputation: 25803

How to go about debugging SystemJS issues?

I have an AngularJS 2.0 app written in TypeScript that uses the SystemJS loader. When I run the app I get the following 404 error:

404 GET /node_modules/ponyfill/package.json

Now as far as I can tell, no module has a dependency on ponyfill. I have other AngularJS apps with similar setups that are working just fine. But I cannot figure out what's the difference with this app. How would you approach debugging such an issue? Are there any tools?

P.S. I found a tools called SystemJS Debugger but the documentation is not very clear.

P.S. My SystemJS configuration looks like this:

System.config({
    "defaultJSExtensions": true,
    "packageConfigPaths": [
        "/node_modules/*/package.json"
    ],
    "paths": {
        "main": "/main",
        "angular2/*": "/angular2/*",
        "rxjs/*": "/rxjs/*",
        "app/*": "/app/*",
        "*": "/node_modules/*"
    },
    "packages": {
        "angular2": {
            "defaultExtension": false
        },
        "rxjs": {
            "defaultExtension": false
        }
    }
});

Edit

I found that packageConfigPaths in the configuration above was causing the problem. It's the one that makes SystemJS go haywire and start looking for package.json files at runtime. If I remove it the issue goes away. I did not find packageConfigPaths documented anywhere. Anyone know what it does. I had simply copied it from a template.

Edit 2

I have put my full application on Github so that anyone can reproduce this issue. The repository is https://github.com/archfirst/angular2-minimal-app. The application should built perfectly fine with the checked-in code. To reproduce the issue, simply edit index.html and uncomment packageConfigPaths and paths properties of the SystemJS configuration.

Upvotes: 1

Views: 574

Answers (2)

deepdivedylan
deepdivedylan

Reputation: 359

I faced a similar problem recently. The solution (as of Angular RC 1) was to include rxjs AFTER System:

<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.min.js"></script>

After re-arranging these script tags, the problem was resolved. Hope this helps.

Upvotes: 0

IgorL
IgorL

Reputation: 1169

looks like typo, try to rename ponyfill to polyfill

Upvotes: 1

Related Questions