I want to avoid using Gulp or Grunt (anyone else tired of those?) and turn
/src
/component
index.jsx
index.jsx
into
/dist
bundle.min.js
using a one-line command that I can put in my package.json
file:
...
"scripts": {
"build": "..."
...
I have been trying with variations of the babel
, babelify
, browserify
, and watchify
command lines to no avail. Here's an example of what I've tried:
watchify src/index.jsx -t [babelify [--presets es2015,react]] -v -o bundle.js
...and there are many other variations I've tried.
Update 1:
I'm close.
watchify -v --extension=.jsx -t [ babelify --presets [ es2015 react ] ]\
-g uglifyify src/index.jsx -o bundle.js
This works, but it doesn't detect changes to src/components/index.jsx
.
Update 2:
If I exclude the (large) React library from the bundle, then everything works:
watchify -v --extension=.jsx -t [ babelify --presets [ es2015 react ] ]\
-g uglifyify --no-bundle-external src/index.jsx -o bundle.js
...which makes me wonder if something is quietly going wrong and watchify is breaking as described in this GitHub issue.