0

I can't get TS debugging to work in visual studio 2015 with angular 2 application. Here is my index / _layout file

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<base href="/" />
@Styles.Render("~/Content/css")

<link rel="stylesheet" type="text/css" href="~/Content/lib/theme.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="~/Content/lib/primeui-ng-all.min.css" />

<!-- 1. Load libraries -->
@*@Scripts.Render("~/startup");*@
<!-- IE required polyfills, in this exact order -->
<script src="~/Scripts/lib/breeze-client/breeze.min.js"></script>
<script src="~/Scripts/lib/es6-shim/es6-shim.min.js"></script>
<script src="~/Scripts/lib/systemjs/dist/system-polyfills.js"></script>
<script src="~/Scripts/lib/shims_for_IE.js"></script>
<script src="~/Scripts/lib/angular2/bundles/angular2-polyfills.js"></script>
<script src="~/Scripts/lib/systemjs/dist/system.src.js"></script>
<script src="~/Scripts/lib/primeui/primeui-ng-all.min.js"></script>
<script src="~/Scripts/lib/rxjs/bundles/Rx.js"></script>
<script src="~/Scripts/lib/angular2/bundles/angular2.dev.js"></script>
<!-- 2. Configure SystemJS -->
<script>
    System.config({
        defaultJSExtensions: true,

        meta: {
            '*.js': { scriptLoad: true } //this allows TS debugging in VS
        },
        packages: {
            app: {
                format: 'register',
                defaultExtension: 'js'
            },

        },
        map: {
            'rxjs': 'scripts/lib/rxjs',
            'angular2': 'scripts/lib/angular2',
            'primeng': 'scripts/lib/primeng'
        }
    });
    System.import('app/main')
        .then(null, console.error.bind(console));
</script>





</head>
<body>

<div class="container body-content">
    @RenderBody()
</div>



@RenderSection("scripts", required: false)
</body>
</html>

here is my tsconfig

{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts",
"typings/browser.d.ts"
]
}

if I comment out the "meta" config everything work correctly and the application loads / runs as expected.

if I put the meta code in, I get the following errors

http://localhost:32532/scripts/lib/angular2/core.js did not call System.register or AMD define. If loading a global module configure the global name via the meta exports property for script injection support

I'm also using ts 1.8.9

2
  • Is the "node_modules" folder part of your VIsual Studio project? The compiler should not be looking down that folder. Make sure it is excluded from your project. Commented Mar 24, 2017 at 20:03
  • I just looked at your path again - are your angular libraries in the node_modules folder or in scripts? Commented Mar 24, 2017 at 20:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.