Last active
February 21, 2016 00:20
-
-
Save jimmythompson/6331b9fe29a63e06d12a to your computer and use it in GitHub Desktop.
Gulp babel example
This file contains hidden or 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
| var gulp = require("gulp"), | |
| gulpWebpack = require("gulp-webpack"), | |
| webpack = require("webpack"); | |
| var buildDirectory = "build"; | |
| gulp.task("build-source", function () { | |
| return gulp | |
| .src("src/js/main.jsx") | |
| .pipe(gulpWebpack({ | |
| output: { | |
| filename: "bundle.js" | |
| }, | |
| resolve: { | |
| extensions: [ '', '.js', '.jsx' ] | |
| }, | |
| module: { | |
| loaders: [{ | |
| test: /\.jsx?$/, | |
| loader: 'babel', | |
| exclude: /node_modules/, | |
| query: { | |
| presets: ['react', 'es2015'] | |
| } | |
| }] | |
| }, | |
| plugins: [ | |
| new webpack.ProvidePlugin([ | |
| 'react' | |
| ]) | |
| ] | |
| })) | |
| .pipe(gulp.dest(buildDirectory)); | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To get this working you'll also need to install the following npm packages: