The easiest way not to use webpack is to just use babel.
At the moment the most minimal set-up I can figure out is to use the babel-cli and babel-preset-react packages.
If you have a package.json file set up you just need to type:
npm install babel-cli babel-preset-env --save-dev
Then you need a .babelrc file with at least the following content: {"presets": ["react"]}
.
If for example your javascript sources are in a js folder, you can compile them to a lib folder by adding a scripts field to your package.json like this:
"scripts": {
"build": "babel js --out-dir lib"
},
So running npm run build
compiles your javascript files to a lib folder.
Then you just need to link the compiled file in your html, like this:
<script src="lib/script.js"></script>
A minimal code to use react would be:
const HelloWorld = function HelloWorld(props, context) {
return <p>Hello <strong>React</strong>!</p>;
};
ReactDOM.render(
<HelloWorld />,
document.getElementById('root'),
);
Notice that with this approach you are not transpiling es6 to es5, so if you want to support older browsers you still need to add the babel-preset-env package, and to modify the .babelrc file like this
{
"presets": ["env", "react"]
}