Skip to content

Instantly share code, notes, and snippets.

@garciamax
Created December 29, 2017 06:24
Show Gist options
  • Save garciamax/5b2b626231072381b4c7bbc649ec3a1d to your computer and use it in GitHub Desktop.
Save garciamax/5b2b626231072381b4c7bbc649ec3a1d to your computer and use it in GitHub Desktop.
webpack + react + babel
{
"presets": ["env", "react"]
}
npm i webpack babel-loader babel-core babel-preset-env babel-preset-react react react-dom prop-types html-webpack-plugin html-loader --save-dev
"scripts": {
"build": "webpack"
}
const path = require("path");
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
entry: ["./src/js/app.js"],
output: {
path: path.resolve(__dirname, "dist"),
filename: "js/[name].js"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment