최원석3 [goesnow]

add css, image loader

...@@ -9,14 +9,10 @@ npx gts init ...@@ -9,14 +9,10 @@ npx gts init
9 9
10 # 개발 10 # 개발
11 11
12 -### 프로젝트 dev 모드
13 -```shell
14 -tsc -w
15 -```
16 -
17 ### 프론트 서버 띄우기 12 ### 프론트 서버 띄우기
18 ```shell 13 ```shell
19 -npm install -g http-server 14 +npm run build
20 -cd ./app 15 +npm run start
21 -http-server ./
22 ``` 16 ```
17 +
18 +`npm run start`만 진행할 시 수정사항이 적용되지 않음
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
24 "devDependencies": { 24 "devDependencies": {
25 "@types/node": "^14.11.2", 25 "@types/node": "^14.11.2",
26 "css-loader": "^5.1.1", 26 "css-loader": "^5.1.1",
27 + "file-loader": "^6.2.0",
27 "gts": "^3.1.0", 28 "gts": "^3.1.0",
29 + "style-loader": "^2.0.0",
28 "ts-loader": "^8.0.17", 30 "ts-loader": "^8.0.17",
29 "typescript": "^4.0.3", 31 "typescript": "^4.0.3",
30 "webpack": "^5.24.3", 32 "webpack": "^5.24.3",
......
1 +declare module '*.png';
1 import {Bye} from './Bye'; 1 import {Bye} from './Bye';
2 import './assets/style/App.css'; 2 import './assets/style/App.css';
3 +import v4 from './assets/image/v4Logo.png';
3 4
4 const hi = 'hchoi won'; 5 const hi = 'hchoi won';
5 6
6 const hi1 = () => { 7 const hi1 = () => {
7 console.log(hi); 8 console.log(hi);
8 Bye(); 9 Bye();
10 +
11 + const tag = window.document.querySelector('#App');
12 +
13 + if(tag) {
14 + tag.innerHTML = `<img src=${v4} alt="image" />`;
15 + }
9 }; 16 };
10 17
11 hi1(); 18 hi1();
...\ No newline at end of file ...\ No newline at end of file
......
1 { 1 {
2 "extends": "./node_modules/gts/tsconfig-google.json", 2 "extends": "./node_modules/gts/tsconfig-google.json",
3 "compilerOptions": { 3 "compilerOptions": {
4 + "lib": ["es5", "es6", "dom"],
4 "rootDir": ".", 5 "rootDir": ".",
5 "outDir": "build", 6 "outDir": "build",
6 "target": "es6", 7 "target": "es6",
...@@ -11,5 +12,5 @@ ...@@ -11,5 +12,5 @@
11 }, 12 },
12 "include": [ 13 "include": [
13 "src/**/*.ts" 14 "src/**/*.ts"
14 - ] 15 + ],
15 } 16 }
......
...@@ -15,7 +15,14 @@ module.exports = { ...@@ -15,7 +15,14 @@ module.exports = {
15 }, 15 },
16 { 16 {
17 test : /\.css$/, 17 test : /\.css$/,
18 - use: ['css-loader'] 18 + use: ['style-loader', 'css-loader'],
19 + },
20 + {
21 + test: /\.(png|jpe?g|gif|jp2|webp)$/,
22 + loader: 'file-loader',
23 + options: {
24 + name: 'images/[name].[ext]'
25 + },
19 } 26 }
20 ] 27 ]
21 }, 28 },
......