I am using Angular 2. I am confused with how Angular 2 with typescript works in production environment with Jboss6.
1.After compiling the file in development machine using node, do we need to deploy both .js and .ts to production level?
I am using Angular 2. I am confused with how Angular 2 with typescript works in production environment with Jboss6.
1.After compiling the file in development machine using node, do we need to deploy both .js and .ts to production level?
Typescript is merely a tool which is a superset of Javascript. After transpiling, your Angular2 code is just plain old Javascript.
You don't need to deploy .ts
files on your servers, as no browser will ever understand or parse TypeScript.
If you check your /dist
folder that contains your production ready code (if you're using some scaffolding), you'll see that there are only .js
files there, in addition to HTML and CSS.
The browser only understands HTML, CSS and Javascript
The browsers only recognize JS files and so when you deploy your app in production should deploy JS files. Typescript is only a superset of Javascript with added features but all Typescript files should be bundled and transpiled.
The main library used for transpiling is Babel for ES6 and the main library for bundling is SystemJS or Webpack.
All is reduced to CSS, JS and HTML files.
Another way, JBoss is a Application Server for Java. For deploy Angular 2 apps you only need a Web Server like Apache, Nginx or Lite-Server.