Skip to content

Instantly share code, notes, and snippets.

@harshq
Last active July 25, 2021 07:49
Show Gist options
  • Save harshq/e50d1fc6191b43176570129f86bb4c3d to your computer and use it in GitHub Desktop.
Save harshq/e50d1fc6191b43176570129f86bb4c3d to your computer and use it in GitHub Desktop.
React with Webpack 5
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const PORT = 3001;
module.exports = {
entry: path.resolve(__dirname, "./src/index.js"),
devServer: {
contentBase: path.join(__dirname, "dist"),
port: PORT,
},
output: {
publicPath: "auto",
},
resolve: {
extensions: [".js", ".jsx"],
},
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.svg$/,
use: ['@svgr/webpack', 'url-loader'],
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
],
},
plugins: [
new HtmlWebpackPlugin({
manifest: "./public/manifest.json",
favicon: "./public/favicon.ico",
template: "./public/index.html",
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment