엔트리와 아웃풋 - 실습,풀이
npm init -y
npm i -D webpack webpack-cli
// webpack.config.js
const path = require('path');
module.exports = {
mode: "development",
entry: {
main: './src/app.js',
},
output: {
path: path.resolve('./dist'),
filename: '[name].js'
}
}
{
"name": "1-entry",
"version": "1.0.0",
"description": "\"프론트엔드 개발 환경의 이해\" 강의 자료입니다.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>검색</title>
<link rel="stylesheet" href="src/main.css">
</head>
<body>
<div id="app">
<header>
<h2 class="container">검색</h2>
</header>
<div class="container">
<form class="FormView">
<input type="text" placeholder="검색어를 입력하세요" autofocus>
<button type="reset" class="btn-reset"></button>
</form>
<div class="content">
<div id="tabs"></div>
<div id="search-keyword"></div>
<div id="search-history"></div>
<div id="search-result"></div>
</div>
</div>
</div>
<!-- TODO: 웹팩으로 빌드한 자바스크립트를 여기에 로딩하세요 -->
<script src="./dist/main.js"></script>
</body>
</html>