I'm using this angular 4 seed app: https://github.com/2sic/app-tutorial-angular4-hello-dnn
It uses webpack and works fine.
It only seems to serve the dev files and not the dist/ folder.
I want to ng serve the dist folder.
Not sure the command to do this or if I need to install a lite server or something.
I run this command to create the dist folder (which works fine):
g build --prod --aot --output-hashing=none
Now I want to run this build in the browser.
You need a server to serve your generated build.
I am using http-server. Install http-server using:
now go inside your dist folder and run this command
as shown here:
Check http://localhost:8080 in your browser
I serve the dist folder with the Angular CLI...
ng serve --prod=true
https://angular.io/cli/serve
At least for Angular apps,
angular-http-server
seems to be a nicer option.First install it with your prefered package manager, say
or
Then execute it:
Look at the repo for more information about usage.
PS: According the author, it should also work with other SPA frameworks (React, Vue and so forth).
ng serve
will work as normal, and it doesn't require a prior build. It generates files in memory, and has some additional features like auto reload.I tried with http-server by installing it globally
then moved to the dist/project-folder and tried with
output in console
Then this solution worked with all the steps same but instead of using http-server try
angular-http-server
It worked for me.
A little tips
so you avoid to install globally
install in your root
in your package.json
than