After the project build, run index.html to display the blank interface.

14
closed
shiran1992
shiran1992
Posted 4 years ago

After the project build, run index.html to display the blank interface. #54

After the project build, run index.html to display the blank interface. default

jirikolarik
jirikolarik
Created 4 years ago

How do you run it? You need to star dev server with npm start in project directory

shiran1992
shiran1992
Created 4 years ago

I see what you mean, that's fine. But I've developed it on this framework, and now I need to build a package, which is the dist folder.In this folder(dist),I ran index.html, which shows the blank, which is what I've just done. -------Thank you very much for your reply! (from a Chinese guy who is working overtime)

jirikolarik
jirikolarik
Created 4 years ago

You need to run a server, which will server index.html and assets, what you can do with running npm run server or node server or with php for example, in this case you have to run php -S localhost:8080 in dist folder.

jirikolarik
jirikolarik
Created 4 years ago

You can also deploy this code to surge for example and they will do this for you

shiran1992
shiran1992
Created 4 years ago

Thank you for your reply .I did what you said, and if you use your empty project, no problem. However, after I have developed on your foundation, the build comes out wrong. default My package.json default

shiran1992
shiran1992
Created 4 years ago

.babelrc default I think my question should be here. What do you think?

jirikolarik
jirikolarik
Created 4 years ago

Try to move transform-runtime and transform-decorators-legacy out of development plugins to just plugins like here:

screen shot 2017-11-21 at 09 18 26

I think this may be it. Because transform-runtime is needed while building the project and that is happening in production env (you can see in packages.json: "build": "NODE_ENV=production webpack --config ./webpack.production.js --profile --colors"). Give it a shot and let me know if it helped

shiran1992
shiran1992
Created 4 years ago

Now I can look at the interface, but the style is not normal . default

jirikolarik
jirikolarik
Created 4 years ago

If you wrote API in server.js, you have to run it as well. It is preconfigured to also serve builded project, so if you run npm run server both of them - api and react app should work, php -S localhost:8080 is not an option in this case

jirikolarik
jirikolarik
Created 4 years ago

Did it worked? @shiran1992

Previous