1

I cloned project from tour of heroes tutorial https://angular.io/docs/ts/latest/guide/setup.html.

And I want to separate .js files to another directory, because now I have .ts, .js and .js.map files all together in one directory.

I tried solve it following the answer from: Separate Angular2 TypeScript files and JavaScript files into different folders, maybe 'dist‘ but after changes in systemjs.config.js and tsconfig.json I get an error:

Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:18 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/app/app.module
    Error: XHR error (404 Not Found) loading http://localhost:3000/app/app.module
        at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:1056:39)
        at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:424:31)
        at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:191:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:486:38)
    Error loading http://localhost:3000/app/app.module as "./app/app.module" from http://localhost:3000/main.js
        at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:1056:39)
        at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:424:31)
        at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:191:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:486:38)
    Error loading http://localhost:3000/app/app.module as "./app/app.module" from http://localhost:3000/main.js
3
  • what IDE you use? Commented Jun 12, 2017 at 20:58
  • visual studio code Commented Jun 12, 2017 at 20:59
  • Most editors will put .js and .js.map 'folded' and hidden if they detect that typescript is used. Nowadays it's not often in a different directory as you describe. Commented Jun 12, 2017 at 21:02

1 Answer 1

2

Add

   "files.exclude": {
    "**/*.js.map": true,
    "**/*.js": {
        "when": "$(basename).ts"
    }
},

to your user settings

Sign up to request clarification or add additional context in comments.

1 Comment

I have a problem. My primary directory is app. And when I have all .ts files in this directory I don't see .js and .js.map files. But when I created a directory app/subdir/subdirectory and I put there .ts files I get .js files in directory app.

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.