Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions FRONT/jognkim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## 설치 모듈
- @babel/core
- @babel/preset-env
- @babel-loader

- webpack
- webpack-cli
- webpack-dev-server
- html-webpack-plugin

- style-loader
- css-loader
- file-loader
- url-loader

- react
- react-dom
12 changes: 12 additions & 0 deletions FRONT/jognkim/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = function(api) {
api.cache(true);

const presets = ["@babel/preset-env", "@babel/preset-react"];

const plugins = [];

return {
presets,
plugins
};
};
196 changes: 196 additions & 0 deletions FRONT/jognkim/dist/bundle.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions FRONT/jognkim/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script defer src="bundle.js"></script></head>
<body>
<div id="root"></div>
</body>
</html>
45 changes: 45 additions & 0 deletions FRONT/jognkim/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "jognkim",
"version": "1.0.0",
"description": "Matching42_practice_FRONT",
"main": "index.js",
"scripts": {
"start": "webpack serve",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Matching42/Matching42_practice.git"
},
"keywords": [
"front",
"practice",
"react",
"no",
"cra"
],
"author": "jongkim",
"license": "ISC",
"bugs": {
"url": "https://github.com/Matching42/Matching42_practice/issues"
},
"homepage": "https://github.com/Matching42/Matching42_practice#readme",
"dependencies": {
"@babel/core": "^7.14.0",
"@babel/preset-env": "^7.14.1",
"@babel/preset-react": "^7.13.13",
"babel-loader": "^8.2.2",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"css-loader": "^5.2.4",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.1",
"style-loader": "^2.0.0",
"url-loader": "^4.1.1",
"webpack": "^5.36.2",
"webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.11.2"
}
}
13 changes: 13 additions & 0 deletions FRONT/jognkim/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="../src/css/index.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
23 changes: 23 additions & 0 deletions FRONT/jognkim/src/components/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { useState } from "react";

const App = () => {
const [count, setCount] = useState(0);

const increase = () => {
setCount(count => count + 1);
}

const decrease = () => {
setCount(count => count - 1);
}

return (
<div>
<h2>{count}</h2>
<button onClick={decrease}>-1</button>
<button onClick={increase}>+1</button>
</div>
);
}

export default App;
8 changes: 8 additions & 0 deletions FRONT/jognkim/src/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* {
margin: 0;
box-sizing: border-box;
}

h2 {
margin-left: 30px;
}
11 changes: 11 additions & 0 deletions FRONT/jognkim/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./components/App";
import "./css/index.css";

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
48 changes: 48 additions & 0 deletions FRONT/jognkim/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
mode: "development",

entry: "./src/index",

resolve: {
extensions: [".js", ".jsx"]
},

module: {
rules: [
{
test: /\.js?$/,
loader: "babel-loader",
exclude: /node_modules/
}, {
test: /\.css$/,
use: ["style-loader", "css-loader"]
}, {
test: /\.(ico|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader",
options: {
name: "[hash].[ext]",
limit: 10000
}
}]
},

output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js"
},

plugins: [
new HtmlWebpackPlugin({
template: `./public/index.html`
})
],

devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 5500
},
};