Skip to content

Instantly share code, notes, and snippets.

@gyeongseokKang
Last active July 6, 2021 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyeongseokKang/d1ab5cef1cf29907c18a070f995933e2 to your computer and use it in GitHub Desktop.
Save gyeongseokKang/d1ab5cef1cf29907c18a070f995933e2 to your computer and use it in GitHub Desktop.
webpack-dev-sever 용 공식문서
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./src/index.tsx",
mode: "development",
devServer: {
contentBase: "./dist", // <- 추가된 부분
hot: true, // <- HMR 설정
},
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
},
{
test: /\.(csv|tsv)$/i,
use: ["csv-loader"],
},
{
test: /\.(ts|tsx)$/i,
use: "babel-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js", ".jsx"],
alias: {
root: __dirname,
src: path.resolve(__dirname, "src"),
},
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist"),
clean: true,
},
plugins: [
new HtmlWebpackPlugin({
title: "my project",
template: path.join(__dirname, "./public/index.html"),
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment