How to run webpack + ReactJS without node.js on client-side?

0

Is it possible to run the webpack transpiler on the client side without installing and running it on a Node.js server?

Currently I am trying to implement a SPA application using React 15.1.0 integrated with Babel-core 5.8.23. But my server-side solution is proprietary and I can not change it due to the support of updates, and it contains a very complex integration between services and applications, where even a Node.js service is available for it.

What path or settings can I follow to run React developed only on the front-end side with execution also only on the client side.

OBS: Currently my main obstacle is importing modularized components that have the error .. Uncaught ReferenceError: require is not defined .

Test Codes:

index.html and main.js

// Arquivo "main.js"

import App from './components/App.js';

ReactDOM.render(
	<App />,
	document.getElementById('app')
);
<!DOCTYPE html>
<html lang="pt-BR">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>Aprendendo React</title>
		<meta name="description" content="Testes com código ReactJS">
		<meta name="viewport" content="width=device-width, initial-scale=1">

		<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script><scripttype="text/babel" src="main.js" ></script>
	</head>
	<body>
		<div id="app"></div>
	</body>
</html>

App.js

export default class App extends React.Component {
    render: function() {
        return <h1>React Ok</h1>;
    }
});
    
asked by anonymous 24.07.2017 / 08:31

0 answers