Run the newly packaged scaffolding project through http-server

Here I packaged my own vue project
react, and the same is true.
If I directly open the index.html below the packaged dist,
there will be a white screen problem such as resource not found or cross-domain.
Insert image description here
This problem can actually be solved with nginx. But in fact, if It’s too troublesome just to test nginx


We can install an http-server terminal execution globally through the npm command

npm install -g http-server

After installing the dependencies, we open the command window as an administrator
, then go to the directory where we packaged
and enter the command in the terminal.

http-server -p 3000

Here we specify that it runs on port 3000. You can enter this port yourself.
Insert image description here
Then at this time, I access the local 3000 port
http://localhost:3000/

Insert image description here
Local projects started

Guess you like

Origin blog.csdn.net/weixin_45966674/article/details/132776361