-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize webpack bundler processor and refactor it
- Loading branch information
Showing
73 changed files
with
5,272 additions
and
1,176 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>React</title> | ||
<meta charset="UTF-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0, maximum-scale=1.5, minimum-scale=0.9, user-scalable=yes" | ||
/> | ||
<title>Webpack5 typescript react boilerplate</title> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<div id="root">Some base container message</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
declare module "*.scss" { | ||
const content: { [className: string]: string }; | ||
export = content; | ||
} | ||
|
||
declare module "*.less" { | ||
const content: { [className: string]: string }; | ||
export = content; | ||
} | ||
|
||
declare module "*.svg" { | ||
import React = require("react"); | ||
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>; | ||
export default ReactComponent; | ||
} | ||
|
||
declare module '*.json' { | ||
const content: Record<string, string>; | ||
export default content; | ||
} | ||
|
||
declare const IS_PROD: boolean; | ||
declare const IS_DEV: boolean; | ||
declare const IS_DEV_SERVER: boolean; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,27 @@ | ||
.appContainer { | ||
text-align: center; | ||
} | ||
|
||
.appLogo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.appLogo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.appHeader { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
} | ||
.styles { | ||
&-header { | ||
font-size: 50px; | ||
color: #fff; | ||
font-family: 'Open Sans', sans-serif; | ||
font-weight: 600; | ||
} | ||
|
||
.appLink { | ||
color: #61dafb; | ||
} | ||
&-image { | ||
$size: 90px; | ||
width: $size; | ||
height: $size; | ||
margin: 25px 0 0 0; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
&-link { | ||
display: block; | ||
margin: 20px 0 0 0; | ||
font-family: 'Open Sans', sans-serif; | ||
font-weight: 400; | ||
color: #fff; | ||
text-decoration: none; | ||
&:hover { | ||
color: #e8e8e8; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
import type { FunctionComponent, ReactElement } from "react"; | ||
import logo from '../../assets/logo.svg'; | ||
import styles from "./App.module.scss"; | ||
import type { PropsWithChildrenOnly } from "types/react"; | ||
import cn from 'classnames'; | ||
import React, {Suspense, lazy} from 'react'; | ||
|
||
import packageJson from '../../../package.json'; | ||
import {stylesContainer} from './app.module.less'; | ||
import {stylesHeader, stylesImage, stylesLink} from './app.module.scss'; | ||
|
||
export function App(): ReactElement { | ||
return ( | ||
<div className={styles.appContainer}> | ||
<Header logo={logo}> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to reload the browser | ||
</p> | ||
</Header> | ||
const LazyStrawberryIcon = lazy(() => import('./strawberry')); | ||
export const App = (): React.ReactElement => ( | ||
<div className={stylesContainer}> | ||
<div className={stylesHeader}>It works</div> | ||
<Suspense fallback={'loading...'}> | ||
<LazyStrawberryIcon className={stylesImage} /> | ||
</Suspense> | ||
<div> | ||
<a | ||
className={cn(stylesLink)} | ||
href="https://github.com/glook/webpack-typescript-react" | ||
target="_blank" | ||
> | ||
@glook/webpack-typescript-react ({packageJson.version}) | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
type HeaderProps = { | ||
logo?: string; | ||
}; | ||
|
||
const Header: FunctionComponent<PropsWithChildrenOnly & HeaderProps> = ({ children, logo }) => ( | ||
<header className={styles.appHeader}> | ||
{logo ? <img src={logo} className={styles.appLogo} alt="logo" /> : "There is no any logo!"} | ||
{children} | ||
</header> | ||
); |
Oops, something went wrong.