Skip to content

Commit 96dfc19

Browse files
committed
first commit
0 parents  commit 96dfc19

File tree

7 files changed

+127
-0
lines changed

7 files changed

+127
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
package-lock.json

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# simple-react-app
2+
3+
react, react-dom, webpack, babel.
4+
5+
一切从简,最简单的配置。
6+
7+
## 启动
8+
9+
```shell
10+
npm run start
11+
```
12+
13+
## 打包
14+
15+
```shell
16+
npm run build
17+
```

babel.config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
],
6+
"plugins": [
7+
"@babel/plugin-proposal-class-properties"
8+
]
9+
}

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Simple React App</title>
8+
</head>
9+
10+
<body>
11+
<div id="root"></div>
12+
</body>
13+
<script src="./index.js"></script>
14+
15+
</html>

index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
class App extends React.Component {
5+
6+
render() {
7+
return (
8+
<div>Hello World1!</div>
9+
)
10+
}
11+
}
12+
13+
ReactDOM.render(
14+
<App />,
15+
document.getElementById('root')
16+
);

package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "simple-react-app",
3+
"version": "1.0.0",
4+
"description": "低配版react-webpack脚手架,快速搭建react基础环境,用于react相关测试。",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "webpack --mode production",
8+
"start": "webpack-dev-server",
9+
"test": "echo \"Error: no test specified\" && exit 1"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/whosMeya/simple-react-app.git"
14+
},
15+
"keywords": [
16+
"simple-react-app",
17+
"react",
18+
"webpack",
19+
"babel"
20+
],
21+
"author": "whosmeya",
22+
"license": "MIT",
23+
"bugs": {
24+
"url": "https://github.com/whosMeya/simple-react-app/issues"
25+
},
26+
"homepage": "https://github.com/whosMeya/simple-react-app#readme",
27+
"devDependencies": {
28+
"@babel/core": "^7.9.0",
29+
"@babel/plugin-proposal-class-properties": "^7.8.3",
30+
"@babel/polyfill": "^7.8.7",
31+
"@babel/preset-env": "^7.9.5",
32+
"@babel/preset-react": "^7.9.4",
33+
"babel-loader": "^8.1.0",
34+
"html-webpack-plugin": "^4.2.0",
35+
"webpack": "^4.42.1",
36+
"webpack-cli": "^3.3.11",
37+
"webpack-dev-server": "^3.10.3"
38+
},
39+
"dependencies": {
40+
"@types/react": "^16.9.34",
41+
"@types/react-dom": "^16.9.6",
42+
"react": "^16.13.1",
43+
"react-dom": "^16.13.1"
44+
}
45+
}

webpack.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const path = require('path');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
4+
let config = {
5+
entry: './index.js',
6+
output: {
7+
path: path.resolve(__dirname, 'dist'),
8+
filename: 'index.js'
9+
},
10+
module: {
11+
rules: [
12+
{ test: /\.js$/, use: 'babel-loader' }
13+
]
14+
},
15+
plugins: [
16+
new HtmlWebpackPlugin({
17+
filename: 'index.html',
18+
template: 'index.html',
19+
}),
20+
],
21+
}
22+
module.exports = config;

0 commit comments

Comments
 (0)