'How to rename Angular Universal entry file to app.js and move it to the app root directory
So I have an Angular Universal SSR
app which runs with node. The latest Angular and Universal versions as of 21/01/2021.
My hosting company allows me to run nodejs apps on my shared cPanel, so I would like to run my Angular app there. But the problem is they only accept the entry file app.js
.
But when Angular SSR is built, it outputs this:
app-name
-> browser
- (all the browser files.)
-> server
-> main.js
Is it possible to output the ng build:ssr
to this:
app-name
-> browser
- (all the browser files.)
-> app.js
Then when I run the app it runs the default app.js entry file.
Thanks!
Solution 1:[1]
I had the same problem in MyDevil hosting. I use scripts to copy and change file name and I used new file to run application in production.
"copy-server": "copyfiles -u 3 ./dist/project-folder/server/main.js ./dist/project-folder/server/mydevil/",
"rename-server": "renamer ./dist/project-folder/server/mydevil/main.js -r ./app.js",
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jakub |