Last active
October 8, 2022 20:03
-
-
Save paulohfev/7d6145de058a777c1ecd0a094f60e64b to your computer and use it in GitHub Desktop.
Minimum webpack config for React-Typescript project
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"); | |
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