These are chat archives for AngularClass/angular2-webpack-starter

26th
Apr 2017
Ritwik Banerjee
@ritwbanerjee
Apr 26 2017 06:38
i m facing some major memory issues with angular-webpack-node-express-redis-socket stack. my v8 heap size increases steadily over time. i already have set my max-old-space size to 2048 and gc_interval at 100
i have zoneJS and RXJS
i have open subsciptions inside components which are not closed
can this be a reason?
paraga-iprogrammer
@paraga-iprogrammer
Apr 26 2017 08:10
I am new to Angular development. Have developed an application using webpack starter. The dev environment runs on 3000 port, and when I switch to production, it runs on 8080. How can I make the prod environment run on port 3000 and change the dev environment to some other port?
Ryan
@ryansonshine
Apr 26 2017 12:34
@paraga-iprogrammer if you want to change the dev environment to a different port have a look at the webpack.dev.js file in the config directory. You should see the following:
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 3000;
const HMR = helpers.hasProcessFlag('hot');
const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
  host: HOST,
  port: PORT,
  ENV: ENV,
  HMR: HMR
});
change the line of
const PORT = process.env.PORT || 3000;
to your desired port
paraga-iprogrammer
@paraga-iprogrammer
Apr 26 2017 13:38
@ryansonshine
Thank you for your response. I was actually wanting to check if similar changes can be made for the production environment
I tried this PORT=8081 HOST="0.0.0.0" npm run server:dev:hmr command while initiating the server and managed to run the production environment on desired port
Will check these configurations recommended as well, thank you
Ryan
@ryansonshine
Apr 26 2017 13:58
@paraga-iprogrammer take a look at https://webpack.js.org/guides/production-build/

more specifically, where the

--define process.env.NODE_ENV

line is found

server:dev:hmr calls server:dev which is actually webpack-dev-server --config config/webpack.dev.js
Franco Zanki
@fazanki
Apr 26 2017 14:03
you can also do something like this
"server:dev": webpack-dev-server --config config/webpack.dev.js --port 3001 --inline --progress
in the package.json file
paraga-iprogrammer
@paraga-iprogrammer
Apr 26 2017 14:11
Thanks guys, will try
Ryan
@ryansonshine
Apr 26 2017 15:00
I'm having trouble getting global styles to be injected into the index.html

it says in the /src/styles/styles.scss:

/* this file will be extracted to main dist folder and is imported in index.html */
/* This file is for setting global styles  */
@import 'main.css';
@import 'fonts.css';

but the main.css and fonts.css are not being applied

do additonal changes need to be made in the webpack.config?
Franco Zanki
@fazanki
Apr 26 2017 15:28
i think the ViewEncapsulation property in component decorator might be the reson for not getting styled
Ryan
@ryansonshine
Apr 26 2017 15:36
@fazanki thanks for the lead; i'll take a look
although, I don't see any of the rules being inserted into the index.html
Franco Zanki
@fazanki
Apr 26 2017 15:38
the global style can be imported into app.component with encapsulation set to none
Ryan
@ryansonshine
Apr 26 2017 15:39
ahh gotcha
cool thanks! @fazanki
Franco Zanki
@fazanki
Apr 26 2017 15:39
👍