3 ms·
Would you mind posting an example of such a browserify call for someone who isn't too familiar?
by teknologist 9y ago
Would you mind posting an example of such a browserify call for someone who isn't too familiar?
- elmigranto 9y agoHere's my Makefile, which includes all the configuration: react, babel, etc. (I do not have any dotfiles in root except for linter). `watch` recompiles on changes and has sourcemaps. You can require any node modules and calls to `fs.readFileSync` will be replaced with `Buffer` objects. NODE_MODULES=../../node_modules NODE_BINARIES=${NODE_MODULES}/.bin BABEL_PRESETS=--presets [ es2017 react ] BABEL_PLUGINS=--plugins [ transform-object-rest-spread ] FLAGS= \ --transform [ babelify ${BABEL_PLUGINS} ${BABEL_PRESETS} ] \ --transform brfs \ --outfile ../../public/bundle.js \ entrypoint.js build: ${NODE_BINARIES}/browserify ${FLAGS} watch: ${NODE_BINARIES}/watchify --debug --verbose ${FLAGS} What it doesn't have is any kind of automatic page reload or code swap and you can't `require` non-js files. There is also no minification for production build. I believe you can have those after couple of minutes on npm, but I haven't tried. Dependencies: yarn add --dev browserify watchify babelify babel-plugin-transform-object-rest-spread babel-preset-es2017 babel-preset-react brfs
- Yaggo 9y agoFor minification you can use e.g. uglifyify transform. Envify also comes in handy. I'm big fan of browserify & npm scripts, I love the simplicity.