Last active
July 25, 2021 07:49
-
-
Save harshq/e50d1fc6191b43176570129f86bb4c3d to your computer and use it in GitHub Desktop.
React with Webpack 5
This file contains 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
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