Skip to content

Commit df2ff7c

Browse files
committed
Initial commit.
1 parent b117677 commit df2ff7c

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed

package.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "reactjs-project-template",
3+
"version": "1.0.0",
4+
"description": "A React.js project template created using Webpack without relying on React.js' CLI command of \"create-react-app\".",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/ewliang/ReactJS-Project-Template.git"
12+
},
13+
"keywords": [
14+
"reactjs",
15+
"react.js",
16+
"webpack",
17+
"reactjs",
18+
"webpack",
19+
"react.js",
20+
"webpack",
21+
"reactjs",
22+
"template",
23+
"reactjs",
24+
"project",
25+
"template",
26+
"reactjs",
27+
"boilerplate"
28+
],
29+
"author": "Eric Liang <[email protected]>",
30+
"license": "MIT",
31+
"bugs": {
32+
"url": "https://github.com/ewliang/ReactJS-Project-Template/issues"
33+
},
34+
"homepage": "https://github.com/ewliang/ReactJS-Project-Template#readme",
35+
"devDependencies": {
36+
"@babel/core": "^7.1.2",
37+
"@babel/preset-env": "^7.1.0",
38+
"babel-loader": "^8.0.4",
39+
"babel-polyfill": "^6.26.0",
40+
"css-loader": "^1.0.0",
41+
"file-loader": "^2.0.0",
42+
"html-webpack-plugin": "^3.2.0",
43+
"style-loader": "^0.23.1",
44+
"webpack": "^4.20.2",
45+
"webpack-cli": "^3.1.2",
46+
"webpack-dev-server": "^3.1.9"
47+
},
48+
"dependencies": {
49+
"@babel/preset-react": "^7.0.0",
50+
"axios": "^0.18.0",
51+
"moment": "^2.22.2",
52+
"normalize.css": "^8.0.0",
53+
"react": "^16.5.2",
54+
"react-dom": "^16.5.2",
55+
"react-router-dom": "^4.3.1"
56+
}
57+
}

public/css/style.css

Whitespace-only changes.

public/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en" dir="ltr">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>HackerNews Clone</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<link rel="icon" type="image/png" href="public/imgs/favicon.ico" />
8+
</head>
9+
<body>
10+
<noscript>Please enable JavaScript on your browser in order for this webapp to work properly.</noscript>
11+
<div id = "app"></div>
12+
</body>
13+
</html>

src/components/App.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React, { Component } from 'react';
2+
import { BrowserRouter, Route, Switch } from 'react-router-dom';
3+
4+
class App extends Component {
5+
render() {
6+
return (
7+
8+
);
9+
}
10+
}
11+
12+
export default App;

src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './components/App';
4+
import 'normalize.css';
5+
import '../public/css/style.css';
6+
7+
ReactDOM.render(<App/>, document.getElementById('app'));

webpack.config.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const path = require('path');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
4+
// Webpack 4
5+
module.exports = {
6+
entry: ['babel-polyfill', './src/index.js'],
7+
output: {
8+
path: path.resolve(__dirname, 'dist'),
9+
filename: 'bundle.js'
10+
},
11+
module: {
12+
rules: [
13+
{
14+
test: /\.(png|jpg|gif|ico|svg|pdf)$/i,
15+
use: [
16+
{
17+
loader: 'file-loader',
18+
options: {
19+
name: '[path][name]-[hash:8].[ext]'
20+
},
21+
}
22+
]
23+
},
24+
{
25+
test: /\.css$/,
26+
use: [
27+
{ loader: 'style-loader' },
28+
{
29+
loader: 'css-loader',
30+
options: {
31+
modules: true
32+
}
33+
}
34+
]
35+
},
36+
{
37+
test: /\.(js|jsx)$/,
38+
exclude: /node_modules/,
39+
loader: 'babel-loader',
40+
options: {
41+
presets: ['@babel/preset-env', '@babel/preset-react']
42+
}
43+
}
44+
]
45+
},
46+
devServer: {
47+
historyApiFallback: true
48+
},
49+
plugins: [
50+
new HtmlWebpackPlugin({
51+
template: './public/index.html'
52+
})
53+
]
54+
};

0 commit comments

Comments
 (0)