First approaching the example, I would expect the following sequence to work, but it doesn't:
git clone https://github.com/yeojz/metalsmith-react-templates.git
cd metalsmith-react-templates/examples/
# replace line in package.json to install from registry: "metalsmith-react-templates": "^4.0.0"
npm install
npm install react react-dom babel-preset-react babel-preset-es2015
node build
There is some trouble with babel and after some non-obvious effort you can repair things, but difficulties arises from the fact that the example isn't independent from the module's build code. I think others run into trouble with the example as well (e.g. https://github.com/yeojz/metalsmith-react-templates/issues/19), so I think making it independent is worthwhile.
This PR gives the example its own .babelrc and makes all the build dependencies explicit in package.json. With these changes, the example builds even if you copied the directory out of this repo.
First approaching the example, I would expect the following sequence to work, but it doesn't:
There is some trouble with babel and after some non-obvious effort you can repair things, but difficulties arises from the fact that the example isn't independent from the module's build code. I think others run into trouble with the example as well (e.g. https://github.com/yeojz/metalsmith-react-templates/issues/19), so I think making it independent is worthwhile.
This PR gives the example its own
.babelrc
and makes all the build dependencies explicit inpackage.json
. With these changes, the example builds even if you copied the directory out of this repo.