├── .gitignore ├── package-lock.json ├── package.json ├── postcss.config.js ├── src ├── App │ ├── index.styl │ └── index.tsx ├── Client.tsx ├── Common │ └── Styles │ │ ├── reset.styl │ │ └── variables.styl ├── Html │ ├── Browser.html │ └── Server.tsx ├── Pages │ ├── Content │ │ ├── index.styl │ │ └── index.tsx │ ├── Home │ │ ├── index.styl │ │ └── index.tsx │ └── Routes.ts └── Server.tsx ├── tsconfig.json ├── webpack.client.js ├── webpack.config.js └── webpack.server.js /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | 4 | # System Files 5 | .DS_Store 6 | Thumbs.db 7 | [Dd]esktop.ini 8 | 9 | # Links 10 | *.lnk 11 | .idea/ 12 | *.PEM 13 | .vscode/ 14 | 15 | # Logs 16 | npm-debug.log 17 | 18 | # Block build and server 19 | /dist 20 | /server -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react_webpack", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "watch": "webpack-dev-server --config webpack.client.js --mode development", 8 | "build": "webpack --config webpack.client.js --mode production", 9 | "dev": "webpack --config webpack.client.js --mode development", 10 | "start": "webpack --config webpack.server.js --mode production && node ./server/main.js" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "devDependencies": { 16 | "@types/express": "^4.17.8", 17 | "@types/react": "^16.9.49", 18 | "@types/react-dom": "^16.9.8", 19 | "@types/react-router-dom": "^5.1.5", 20 | "autoprefixer": "9.8.6", 21 | "clean-webpack-plugin": "^3.0.0", 22 | "css-loader": "^4.3.0", 23 | "express": "^4.17.1", 24 | "html-webpack-plugin": "^4.4.1", 25 | "mini-css-extract-plugin": "^0.11.2", 26 | "postcss-csso": "^4.0.0", 27 | "postcss-loader": "^4.0.2", 28 | "style-loader": "^1.2.1", 29 | "stylus": "^0.54.8", 30 | "stylus-loader": "^3.0.2", 31 | "ts-loader": "^8.0.3", 32 | "typescript": "^4.0.2", 33 | "uglifyjs-webpack-plugin": "^2.2.0", 34 | "webpack": "^4.44.2", 35 | "webpack-cli": "^3.3.12", 36 | "webpack-dev-server": "^3.11.0", 37 | "webpack-node-externals": "^2.5.2", 38 | "webpack-notifier": "^1.8.0" 39 | }, 40 | "dependencies": { 41 | "react": "^16.13.1", 42 | "react-dom": "^16.13.1", 43 | "react-router-dom": "^5.2.0" 44 | }, 45 | "browserslist": [ 46 | "last 2 versions" 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('autoprefixer'), 4 | require('postcss-csso'), 5 | ] 6 | } -------------------------------------------------------------------------------- /src/App/index.styl: -------------------------------------------------------------------------------- 1 | @import "./../Common/Styles/reset.styl" 2 | 3 | html 4 | font-size 10px 5 | 6 | html, body, #root 7 | height 100% 8 | 9 | body 10 | -webkit-font-smoothing antialiased 11 | -webkit-text-size-adjust 100% 12 | -webkit-tap-highlight-color rgba(0,0,0,0) 13 | 14 | font-family $font-main 15 | 16 | background-color $background 17 | 18 | .menu 19 | display flex 20 | 21 | padding 20px 22 | 23 | & a 24 | display inline-block 25 | 26 | font-size 1.6rem 27 | 28 | color #fff 29 | 30 | text-decoration none 31 | 32 | padding-left 10px 33 | padding-right 10px -------------------------------------------------------------------------------- /src/App/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { 3 | Link, 4 | Switch, 5 | Route, 6 | } from 'react-router-dom' 7 | import { Pages } from 'Pages/Routes' 8 | 9 | export function App() { 10 | require('./index.styl') 11 | 12 | return 13 |
14 | {Pages.map((page, index) => {page.title})} 15 |
16 | 17 | 18 | {Pages.map((page, index) => )} 19 | 20 |
21 | } -------------------------------------------------------------------------------- /src/Client.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import { BrowserRouter } from 'react-router-dom' 4 | import { App } from 'App' 5 | 6 | const entryBlock = document.getElementById('root') 7 | const renderFunction: ReactDOM.Renderer = entryBlock.hasChildNodes() ? ReactDOM.hydrate : ReactDOM.render 8 | 9 | renderFunction( 10 | 11 | , entryBlock) -------------------------------------------------------------------------------- /src/Common/Styles/reset.styl: -------------------------------------------------------------------------------- 1 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, 2 | blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, 3 | ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, 4 | center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, 5 | tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, 6 | figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, 7 | summary, time, mark, audio, video 8 | margin 0 9 | padding 0 10 | border 0 11 | font-size 100% 12 | font inherit 13 | vertical-align baseline 14 | box-sizing border-box 15 | 16 | article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, 17 | section 18 | display block 19 | 20 | body 21 | line-height 1 22 | 23 | ol, ul 24 | list-style none 25 | 26 | blockquote, q 27 | quotes none 28 | 29 | :before, :after 30 | content '' 31 | content none 32 | 33 | table 34 | border-collapse collapse 35 | border-spacing 0 -------------------------------------------------------------------------------- /src/Common/Styles/variables.styl: -------------------------------------------------------------------------------- 1 | $font-main = Helvetica, Arial, sans-serif 2 | 3 | $background = #24292e -------------------------------------------------------------------------------- /src/Html/Browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | React Starter Pack 8 | 9 | 10 |
11 | 12 | -------------------------------------------------------------------------------- /src/Html/Server.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | interface Html { 4 | scripts: Array 5 | } 6 | 7 | export function Html({ children, scripts }: React.PropsWithChildren) { 8 | return ( 9 | 10 | 11 | 12 | 13 | 14 | React Starter Pack 15 | 16 | 17 |
{children}
18 | {scripts.map((script, index) =>