-
Notifications
You must be signed in to change notification settings - Fork 12k
ng run project:server universal production not possible #10417
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
Comments
The following should work: |
OK that makes sense but I now get an error of
even though I have a configuration.
|
I confirm this issue.
|
Can anyone advise how to resolve this at the moment I've having to overwrite my dev environment with the product one just to get things working which obviously isn't ideal |
I wondering if this is also causing other issues when running in production as when I upload to my server is just doesn't run, no errors and no changes since angular 5 which runs fine. Seems to running locally though. Anyway have reverted back to v5 for now. |
Also tested on a clean install and |
and what about |
This is how I got it working: I created a
And I have this in my
This made my server side app read the production environment. |
@beeman thanks that has worked, I thought I'd tried this before but perhaps I did it wrong or something has changed. |
Actually there's still something that's not quite right in regards to this issue I raised which is probably actually a cli issue This docs state that
|
@dottodot I have this as my start script: |
@beeman Unfortunately I'm not seeing any difference with that. I'm assuming you mean in package.json right, but aren't you building server.ts with webpack so you'd do |
@dottodot no, I'm running server.ts directly with If you are using webpack to build your server, try adding this:
That was what was previously in Angular CLI. |
@beeman That would work for your application being built by webpack but not the browser side of it. @hakobpogh I have a PR for that here: angular/devkit#863 |
@Toxicable I don't use NODE_ENV in my Angular code so I wouldn't know the details, just pointing out to @dottodot how he might achieve his goals :-) |
@beeman Yeah same here. But either way it's still a regression that should be fixed. |
setting NODE_ENV in my webpack config works for me as I'm only using NODE_ENV in my server.ts but definitely needs fixing as could cause wider issues for others. |
@dottodot If you're using NODE_ENV in your server.ts you should use real environment variables, the ones that come from your actual environment under |
Closing as per @clydin explanation |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Repro steps
This builds the app in production mode but the universal server app uses the dev environment rather than production
I probably just missing something in my config but not sure what.
The text was updated successfully, but these errors were encountered: