Skip to content

Commit aac957c

Browse files
committed
improve
1 parent bfa2a32 commit aac957c

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
"demo": "webpack-dev-server --open"
44
},
55
"dependencies": {
6-
"react": "16.9.0",
7-
"react-dom": "16.9.0"
6+
"react": "17.0.1",
7+
"react-dom": "17.0.1",
8+
"ts-node": "9.1.1"
89
},
910
"devDependencies": {
11+
"@types/html-webpack-plugin": "3.2.4",
1012
"@types/node": "12.7.2",
1113
"@types/react": "16.9.2",
1214
"@types/react-dom": "16.9.0",
15+
"@types/webpack": "4.41.25",
1316
"css-loader": "3.2.0",
1417
"html-webpack-plugin": "3.2.0",
1518
"source-map-loader": "0.2.4",
19+
"strip-ansi": "6.0.0",
1620
"style-loader": "1.0.0",
1721
"ts-loader": "6.0.4",
1822
"typescript": "3.8.3",

src/entry.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom'
33

4-
import Hello from './hello'
4+
import { Hello } from './hello'
55

66
ReactDOM.render(
77
<Hello/>,

src/hello.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
//import * as React from 'react'
2-
import React from 'react'
1+
import React, { FC } from 'react';
32

4-
export default function Hello() {
3+
type Props = {};
4+
5+
export const Hello: FC<Props> = ({}) => {
56
return <div>
67
<h1>Hello React</h1>
7-
</div>
8-
};
8+
</div>;
9+
}

webpack.config.js renamed to webpack.config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
const HtmlWebpackPlugin = require('html-webpack-plugin')
2-
const path = require('path');
1+
import { Configuration } from 'webpack';
2+
import HtmlWebpackPlugin from 'html-webpack-plugin';
3+
import path from 'path';
34

4-
module.exports = {
5+
const config: Configuration = {
56
mode: 'development',
67
entry: './src/entry.tsx',
7-
devtool: "inline-source-map",
8+
devtool: 'inline-source-map',
89
output: {
910
path: path.resolve(__dirname, 'dist'),
1011
filename: 'bundle.js'
@@ -23,3 +24,5 @@ module.exports = {
2324
new HtmlWebpackPlugin()
2425
]
2526
}
27+
28+
export default config;

0 commit comments

Comments
 (0)