1

Can I get this result modifying tsconfig.json or package.json?

I want this structure:

angular2-quickstart
  app
    ts
      app.component.ts
      main.ts
    js
      app.component.js
      app.component.js.map
      main.js
      main.js.map
index.html
license.md

no this:

angular2-quickstart
  app
    app.component.ts
    main.ts
    app.component.js
    app.component.js.map
    main.js
    main.js.map
index.html
license.md
2

2 Answers 2

3

Yes, you can tell the TypeScript compiler to output .js files to a different directory using the outDir option in tsconfig.json, and I'd recommend setting the rootDir too so as to avoid unpleasant surprises in the future:

{
  "compilerOptions": {
    "outDir": "app/js",
    "rootDir": "app/ts",
  }
}

Don't forget to adjust paths in index.html.

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

1 Comment

It's not working in version Angular 2 - rc7. Please Update
2

If you want to separate out .js and .ts files in angular2, you have to follow only two steps:-

1) Add "outDir":"<folder name where you want to put your js Files>" within compilerOptions object in tsconfig.json file.

2) Map your folder in systemjs.config.js i.e modify the map object like

 map:{
     app:<Folder-Name which you have specified in outDir>
     ----
     ----

 }

Comments

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.