Skip to content

Instantly share code, notes, and snippets.

@reggie3
Created October 1, 2017 23:47
Show Gist options
  • Save reggie3/648fcdd732faa7960c75b1ef5ff5d1da to your computer and use it in GitHub Desktop.
Save reggie3/648fcdd732faa7960c75b1ef5ff5d1da to your computer and use it in GitHub Desktop.
Webpack to Convert JSX
const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./web/braintreeReact.js",
output: {
path: path.join(__dirname, "dist"),
filename: "[name].bundle.js"
},
module: {
rules: [
{
test: /\.js$/,
include: [path.resolve(__dirname, "web")],
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
presets: [
[
"env",
{
targets: {
browsers: ["last 2 versions", "safari >= 7"]
}
}
],
"react",
"stage-2"
],
plugins: ["babel-plugin-transform-object-rest-spread"],
babelrc: false
}
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: "./web/braintreeReact.html",
inject: "body"
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment