5

Apologies for a very newb question, but can a project created with the Angular-CLI (which seems to only be able to run with ng serve) be run instead with lite-server, as it currently is on Angular's own Quickstart page?

As a beginner I appreciate the simplicity of lite-server in that doesn't seem to do all this smoke and mirrors with bundling files together in very opaque ways in the way that ng serve seems to do with Webpack. I'm sure there reasons for it, but it's not helping me to understand what's going on under the hood at this point as I'm just getting my feet wet.

Is there any simple way to retrofit what the CLI spits out to run with lite-server, or should I just continue to start new projects by cloning the Quickstart rather than using the CLI tool?

Thanks for any insight!

davidlav
  • 636
  • 5
  • 17
  • I do not see a reason why it should not work (make sure you run also the Typescript compiler tsc). Angular-cli though is great when you start building for prod – Picci Oct 22 '16 at 05:52
  • I've tried installing it and after using a `bs-config` file to successfully point it to `index.html` it shows me the "Loading..." page, but then never starts up any of the scripts. And that's the part that I don't know how to do (or know if it's even possible/worth it). – davidlav Oct 22 '16 at 06:23
  • angular-cli they've taken different recipe from angular-seed. I've used angular-cli works fine. whats the issue – vels4j Oct 22 '16 at 07:49
  • Have a look at the browser console to see details about the prob. In any case angular-cli works fine – Picci Oct 22 '16 at 08:03
  • 2
    You can try `ng build --watch && cd dist && lite-server` . – Vamshi Feb 22 '17 at 22:57
  • I've had the same issue as @davidlav. Creating a project through Angular CLI, installing lite-server and creating the bs-config file didn't work. – juliano.net May 28 '17 at 22:58
  • You can find a working example of this in the Pro Angular book. Source code is available in Github - https://github.com/Apress/pro-angular-2ed/tree/master/Angular%202.0/11%20-%20Creating%20an%20Angular%20Project/example – Kieren Dixon Jun 27 '17 at 11:22

1 Answers1

0

Script tag to run Angular Application on Lite Server

devDependencies must contain lite-server dependencies

Step 1 : Please check above configuration exist in package.json file. If it is not available than code like above given images. Step 2 : Remove you node-modules folder. Step 3 : fire command npm install. (It will install all your dependencies again) Step 4 : Run your application.

Your application will run on lite server Download Sample Example to Run Application on Lite Server

Giriraj
  • 9
  • 2