Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production build #41

Closed
SonicGD opened this issue Oct 21, 2015 · 32 comments · Fixed by #329
Closed

Production build #41

SonicGD opened this issue Oct 21, 2015 · 32 comments · Fixed by #329
Assignees
Labels
effort3: hard (weeks/months) feature Issue that requests a new feature P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@SonicGD
Copy link

SonicGD commented Oct 21, 2015

ng build --environment=production

generate dist with dev versions of angular and systemjs, and my app files with .ts and source maps.

@jimthedev
Copy link
Contributor

Are you getting a specific error? I was able to run this it generates to dist/

Make sure you've got node > 4.1.0.

@SonicGD
Copy link
Author

SonicGD commented Oct 23, 2015

No, i don't say it fails, i say it's not 'production'. Production build should contain .min lib files, no ts or sourcemaps and etc

@IgorMinar
Copy link
Contributor

Prod builds (or any custom environment builds) are currently not supported. It's one of the many things that need to happen in order to make this project production ready.

@cironunes cironunes added the feature Issue that requests a new feature label Nov 27, 2015
@sivaah
Copy link

sivaah commented Dec 15, 2015

Looks like the /dist directory contains the exact copy of src directory including typescript files. I think the typescript files are not required in /dist. The /dist/vendor directory is clean, which has only the javascript files.

@cironunes
Copy link
Member

In order to do the production build we can take the current build and:

  • remove livereload references in the index.html
  • stop copying the ts files
  • stop copying the tsconfig.json file
  • add a CNAME?
  • enableProdMode()
  • assure that pre-compiled style (LESS/SASS) files are not copied to the dist directory (tks @Brocco )

What else?

@cironunes cironunes self-assigned this Jan 26, 2016
@Brocco
Copy link
Contributor

Brocco commented Jan 26, 2016

Assure that pre-compiled style (LESS/SASS) files are not copied to the dist directory

@filipesilva
Copy link
Contributor

Config files perhaps, with API addresses and 3rd party services tokens.

@alexpaluzzi
Copy link
Contributor

I think this list looks good @cironunes. Will we also be minifying/mangling?

Really, this production flow is the only thing missing for me to start using this hard right now.

@hansl hansl added this to the alpha.0 milestone Mar 17, 2016
@hansl hansl changed the title Can't do production build Production build Mar 18, 2016
@hansl
Copy link
Contributor

hansl commented Mar 18, 2016

Picked this as the official production build issue to follow.

cironunes added a commit to cironunes/angular-cli that referenced this issue Mar 20, 2016
For production build:
- remove live reload references (still not 100%)
- stop copying tests and .ts files + tsconfig.json

Missing:
- enableProdMode()
- add a CNAME file

Closes angular#41
cironunes added a commit to cironunes/angular-cli that referenced this issue Mar 21, 2016
For production build:
- remove live reload references (still not 100%)
- stop copying tests and .ts files + tsconfig.json

Missing:
- enableProdMode()
- add a CNAME file

Closes angular#41
cironunes added a commit to cironunes/angular-cli that referenced this issue Mar 24, 2016
For production build:
- remove live reload references (still not 100%)
- stop copying tests and .ts files + tsconfig.json

Missing:
- enableProdMode()
- add a CNAME file

Closes angular#41
cironunes added a commit to cironunes/angular-cli that referenced this issue Mar 25, 2016
For production build:
- remove live reload references (still not 100%)
- stop copying tests and .ts files + tsconfig.json

Missing:
- enableProdMode()
- add a CNAME file

Closes angular#41
cironunes added a commit to cironunes/angular-cli that referenced this issue Mar 25, 2016
For production build:
- remove live reload references (still not 100%)
- stop copying tests and .ts files + tsconfig.json

Missing:
- enableProdMode()
- add a CNAME file

Closes angular#41
cironunes added a commit to cironunes/angular-cli that referenced this issue Mar 25, 2016
For production build:
- remove live reload references (still not 100%)
- stop copying tests and .ts files + tsconfig.json

Missing:
- enableProdMode()
- add a CNAME file

Closes angular#41
cironunes added a commit to cironunes/angular-cli that referenced this issue Apr 2, 2016
For production build:
- remove live reload references (still not 100%)
- stop copying tests and .ts files + tsconfig.json

Missing:
- enableProdMode()
- add a CNAME file

Closes angular#41
cironunes added a commit to cironunes/angular-cli that referenced this issue Apr 3, 2016
@cironunes cironunes reopened this Apr 4, 2016
@cironunes
Copy link
Member

Still missing:

@alexpaluzzi
Copy link
Contributor

So we are bundling now? That would be the best news I've heard all week.

@cironunes
Copy link
Member

I'd love to continue working on that, but I just don't have the time at the moment :(
I'm glad that Filipe is taking care of it. 😄

@filipesilva
Copy link
Contributor

@cironunes I added another item to the list:

@JohannesHoppe
Copy link
Contributor

You are talking about adding a CNAME file, which implies that Github Pages is a "first citizen". If you directly support gh-pages, than you also want to copy dist/index.html to dist/404.html. This will enable browser-reloads together with the PathLocationStrategy.

@alexpaluzzi
Copy link
Contributor

I know still WIP here, but am I missing a flag for using the production vendor libs or is it just unfinished? I can only get angular2.dev.js for instance. That ~1 second bootstrapping time is maddening. Cheers!

@filipesilva
Copy link
Contributor

That bit is the next one I'm working on, to be able to bundle stuff.

@cdarken
Copy link

cdarken commented May 19, 2016

Is there any way to add a custom environment by creating a file named for instance config/environment.stage.ts and then execute ng build --environment=stage ? It looks like it's defaulting to dev now.

@filipesilva
Copy link
Contributor

@cdarken no, it is not currently possible to have more environments other than dev and prod. It's one of my next action items though.

I should mention though (since I haven't yet updated the readme), all builds using -prod use bundling and tree shaking at the moment.

@cdarken
Copy link

cdarken commented May 19, 2016

Thanks, I will wait patiently then.

@mashhoodr
Copy link

hello @filipesilva do we have an approximate timeline for this? I have a project that I will need to deploy to production soon, is there anything you recommend we should use until this is completed?

@filipesilva
Copy link
Contributor

@mashhoodr you can already do production builds, the thing that is missing is more than 2 environments.

@marcalj
Copy link

marcalj commented Jun 3, 2016

What about Service Workers?
Also images are minifyed and filerevved? (for permanent caching)

Thanks guys!!!

@filipesilva
Copy link
Contributor

Currently service workers are only enabled for mobile projects, but we're looking at having them in all prod builds.

Images are not processed at the moment either.

@filipesilva filipesilva added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Jun 4, 2016
@filipesilva
Copy link
Contributor

I think this issue is obsolete by now. All of the features mentioned so far have been addressed, with the possible exception of having service workers in all prod builds. That warrants discussion though so probably should be another issue.

@pardipbhatti8791
Copy link

can anyone tell plz how to run angular cli production mode forever. i want to deploy production build on live server. But i am not getting it.

@neilhem
Copy link
Contributor

neilhem commented Aug 15, 2016

Run ng build -prod

@Avien
Copy link

Avien commented Nov 6, 2016

Currently ng build --prod still generates source maps
How can I build without suorce maps?
Thanks

@Misiu
Copy link

Misiu commented Dec 1, 2016

@neilhem is there an option to skip sourcemaps generation when building using ng build -prod?

@Perezmarc
Copy link

Perezmarc commented Dec 21, 2016

Hey @Misiu, I'm using ng build --prod --aot --no-sourcemap --no-vendor-chunk for my production build.

Still, I get too many files that I believe are unnecessary (but maybe they're not). Would be nice to have all the production deployment options such as: How to deploy gzipped version, how to deploy not gzipped version, with sourcemaps, without sourcemaps...

This are all the files I get when I execute that command. Would appreciate a way to tidy up the production build, maybe include folders to separate files, such as 'js' & 'css'. I also would like to know if I can upload to my cloudfront the .gz without uploading the .js

captura de pantalla 2016-12-21 a les 10 34 17

my angular-cli.json

{
"project": {
"version": "1.0.0-beta.22-1",
"name": "webapp-21b"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"download",
".well-known",
"robots.txt",
"sitemap.xml"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.css",
"./css/main.scss",
"./css/buttons.scss",
"./css/forms.scss",
"./css/navbar.scss",
"./css/nouislider.scss",
"./css/mixins.scss",
"./css/spinner.scss",
"./css/utils.scss",
"./css/vars.scss"
],
"scripts": [
"./assets/js/noUiSlider.9.0.0/nouislider.min.js",
"./assets/js/wNumb.js"
],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [
],
"packages": [
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}

@Mahi8686
Copy link

Mahi8686 commented Feb 9, 2017

Can anybody explain,
how to run forever with angular-cli?
What changes i need to do in my files?

Thanks :)

mvrahden added a commit to mvrahden/learning-agents that referenced this issue Apr 19, 2018
wildVeli referenced this issue in wildVeli/wildVeli.github.io Jun 19, 2019
RouteTest
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort3: hard (weeks/months) feature Issue that requests a new feature P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.