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

18th
Jan 2016
Artur Rozwalak
@arozwalak
Jan 18 2016 09:24
I have a question about production version. after running npm run build:prod and start live-server in dist directory when I go to http://localhost:3000/ applications works and go through angular routing but when I refresh browser on any other view (not root '/') I receive Cannot GET /other-url
how should I configure my production environment so it can handle angular routes?
I'm using PathLocationStrategy
Artur Rozwalak
@arozwalak
Jan 18 2016 09:35
anyway I will run my production version on nginx so maybe it will be enough to redirect all other routes to '/' with given path
Artur Rozwalak
@arozwalak
Jan 18 2016 09:48
other problem when I try to run npm run server:prod I get EADDRINUSE but I don't have other process running on that port.
http-server dist --cors --host 0.0.0.0 --port 3000

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 0.0.0.0:8080
    at Object.exports._errnoException (util.js:856:11)
    at exports._exceptionWithHostPort (util.js:879:20)
    at Server._listen2 (net.js:1237:14)
    at listen (net.js:1273:10)
    at net.js:1382:9
    at nextTickCallbackWith3Args (node.js:489:9)
    at process._tickCallback (node.js:395:17)
    at Function.Module.runMain (module.js:432:11)
    at startup (node.js:141:18)
    at node.js:1003:3
Artur Rozwalak
@arozwalak
Jan 18 2016 10:36
ok, I noticed that http-server has different parameters than set in webpack.config.js
it should be -a rather than --host and -p rather that --port
and for previous issue I just switched from PathLocationStrategy to HashLocationStrategy
Artur Rozwalak
@arozwalak
Jan 18 2016 17:01
is it possibility that on prod version name of route isn't changed for 'n'?
when I'm running dev version of my project router.hostComponent.name returns proper namee of current route, but when I run prod version it's changed to 'n'