Last active
July 6, 2021 11:49
-
-
Save gyeongseokKang/d1ab5cef1cf29907c18a070f995933e2 to your computer and use it in GitHub Desktop.
webpack-dev-sever 용 공식문서
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", | |
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