Skip to content

Instantly share code, notes, and snippets.

@KrustyC
Created May 9, 2021 11:48
Show Gist options
  • Save KrustyC/d6b78be963822cf158673e775202e954 to your computer and use it in GitHub Desktop.
Save KrustyC/d6b78be963822cf158673e775202e954 to your computer and use it in GitHub Desktop.
App Js File for React Medium tutorial
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
output: {
path: path.join(__dirname, "/dist"), // Files will be sent here once they are bundled
filename: "index_bundle.js", // name of the bundle generated by Webpack
},
// webpack 5 comes with devServer which loads in development mode
devServer: {
port: 3000,
watchContentBase: true,
},
module: {
rules: [
{
test: /\.(js|jsx)$/, // Specify for which file types, this loader should be used
exclude: /node_modules/, // Do not compile node_modules, as they should be already compiled
use: {
loader: "babel-loader", // Use the babel-loader to compile the files
},
},
],
},
// Use src/index.html as the HTML entry point
plugins: [new HtmlWebpackPlugin({ template: "./src/index.html" })],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment