简体   繁体   中英

Buld a angular2 webpack production project without source code on the dist folder

I am working on a web application using angular 2 with typescript and angular-cli. I wanted to make a test on the server but I didn't want to upload the source code then I tried using the command "ng build --prod". I see that the .map files was on the folder yet and I deleted all .map files and I uploaded the folder on the server, When I opened the dev tool on chrome I saw the source code with TypeScript. The files that I didn't delete were the .gz files. My question is What is the correct way to build a production project without the typescript code with webpack?.

Sorry but I don't speak english well. And I don't know if I am describing in the corret way my dude.

What I want is not to show my TypeScript code for anyone that activate developer mode.

I'm not sure what you mean by, "build a production project without the typescript code".

When you build a project with ng build it compiles all the typescript into js and minifies it. For example, here is the output of ng build for me (note there are no typescript files here):

在此处输入图片说明

As you noted you can also use the -prod which sets the environment production value to true and gives you a slightly smaller, more optimized build. If you just want to test you app in the browser you can use ng serve or ng serve -prod .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM