Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run React project without npm start?

Tags:

I'm in a big trouble. Working in a part time in a company they're looking for a new web technology to build "web-component" in their website.

They have started to use AngularJS (first version) and I told them that, with the recent evolution of this framework, it's not the right period of time to deal with it.

That's why I began to be interested in ReactJS. However, they don't have a node.js server infrastructure (and that's why AngularJS suits to them, only one browser is sufficient) so it's impossible to run it with something like "npm start".

SO ! My question is (as my post's title says...) :

Is it possible to run ReactJS without server side ?

I've tried with the following line in my header

<script src="https://unpkg.com/react@15/dist/react.js"></script> <script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

But it remains a blank page.

Maybe there is something I don't understant in the react structure and that's why I'm looking for some help/explanations from you.

I hope I have been clear enough ! Thank you in advance for answer.

like image 288
Bram'in Avatar asked Feb 16 '17 16:02

Bram'in


1 Answers

It is absolutely possible to run a React app without a production node server. Facebook provides an easy-to-use project bootstrapper that you can read about here

That being said, developers may need to use a node dev server locally via npm start, as well as using node to perform production builds via npm run build. But one can take the build output from npm run build and serve it from any static server and have a working react application.

like image 88
CaptEmulation Avatar answered Oct 12 '22 09:10

CaptEmulation