최원석3 [goesnow]

webpack with typescript

......@@ -9,6 +9,7 @@ package-lock.json
app/build/*.map
app/build/*.js
build
public
key.py
admin.py
......
......@@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<title>home</title>
</head>
<body>
<div id="App"></div>
<script type="module" src="build/dist/main.js" ></script>
<script type="module" src="public/main.js" ></script>
</body>
</html>
\ No newline at end of file
......
......@@ -13,19 +13,19 @@
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "gts lint",
"clean": "gts clean",
"compile": "tsc",
"fix": "gts fix",
"prepare": "npm.cmd run compile",
"pretest": "npm.cmd run compile",
"posttest": "npm.cmd run lint",
"compile": "tsc -w",
"build": "webpack --watch",
"dev": "tsc -w",
"start": "http-server ./",
"hot": "webpack serve --open"
"start": "webpack serve --open"
},
"devDependencies": {
"@types/node": "^14.11.2",
"css-loader": "^5.1.1",
"gts": "^3.1.0",
"ts-loader": "^8.0.17",
"typescript": "^4.0.3",
"webpack": "^5.24.3",
"webpack-cli": "^4.5.0",
......
body{
background-color: beige;
}
\ No newline at end of file
import {Bye} from './Bye';
import './assets/style/App.css';
const hi = 'hello?';
const hi = 'hchoi won';
const hi1 = () => {
console.log(hi);
......
......@@ -3,17 +3,34 @@ const path = require('path')
module.exports = {
mode : 'development',
entry : {
main : './build/src/index.js'
// main : './build/src/index.js'
main : './src/index.ts'
},
module : {
rules : [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
{
test : /\.css$/,
use: ['css-loader']
}
]
},
resolve : {
extensions: [".tsx", ".ts", ".js"],
},
output : {
publicPath: '/app/build/dist',
path: path.resolve('./build/dist'),
publicPath: '/app',
path: path.resolve('./public'),
filename: '[name].js',
},
devServer : {
port : 3000,
hot: true,
contentBase: ['./build','./src'],
contentBase: __dirname,
inline: true,
watchOptions: {
poll: true
......