Manuel
Manuel

Reputation: 11469

Move Angular 2 generated files to separate folder

I'm trying to clean up my work space from the generated files (mainly .js and .map). Taking the quickstart I tried adding "outDir": "build", to the tsconfig.json and then modifying index.html to use System.import('build/boot'), but I just get a blank "Loading..." page and Uncaught SyntaxError: Unexpected token < on the console.

Related question, in case it is possible to move the generated files to a separate folder, what would happen to component files that are moved or renamed? Seems like the build folder will leave the old ones intact. Any way around it? (keep them in sync)

Upvotes: 1

Views: 2386

Answers (1)

ColinE
ColinE

Reputation: 70142

You are correct that you can update tsconfig.json to generate javascript (and sourcemaps) in a different folder. However, you will also have to move static assets (HTML, CSS) into this folder too. I wrote a blog post about how to achieve this with Gulp:

Creating an Angular 2 build with Gulp, TSLint and DefinitelyTyped

Upvotes: 1

Related Questions