Created
April 19, 2017 01:54
-
-
Save kessler/e51d738e81672a2f41a565e1dae33477 to your computer and use it in GitHub Desktop.
browserify middleware transform example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const express = require('express') | |
const browserifyMiddleware = require('browserify-middleware') | |
const path = require('path') | |
browserifyMiddleware.settings('transform', [ | |
[{ presets: ['es2015', 'react', 'stage-2']}, 'babelify'] | |
]) | |
const jsClientPath = path.resolve(__dirname, '..', 'browser', 'client.js') | |
const app = express() | |
app.get('/js/client.js', browserifyMiddleware(jsClientPath)) | |
// also need to `npm install --save babel-preset-es2015 babel-preset-react babel-preset-stage-2` |
Author
kessler
commented
May 30, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment