Last active
July 6, 2021 11:02
-
-
Save gyeongseokKang/86d99194e840cc298561c5e7e7aa47c5 to your computer and use it in GitHub Desktop.
HtmlWebpackPlugin 설정 및 dist 제거 코드
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", | |
mode: "development", | |
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, // <- 기존 dist 삭제 코드 | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
title: "my project", // <-타이틀 설정 | |
template: path.join(__dirname, "./public/index.html"), // <- 만들어진 index.html | |
}) | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment