Skip to content

Instantly share code, notes, and snippets.

@paulohfev
Last active October 8, 2022 20:03
Show Gist options
  • Save paulohfev/7d6145de058a777c1ecd0a094f60e64b to your computer and use it in GitHub Desktop.
Save paulohfev/7d6145de058a777c1ecd0a094f60e64b to your computer and use it in GitHub Desktop.
Minimum webpack config for React-Typescript project
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./src/index.tsx",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
loader: require.resolve("babel-loader"),
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|jpg|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
},
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment