chore: cra eject

This commit is contained in:
Chance Hudson
2022-05-24 18:42:54 -05:00
parent 306330d25c
commit 1d8d5067e3
7 changed files with 795 additions and 8432 deletions

9019
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-typescript": "^7.17.12",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
@@ -10,24 +12,33 @@
"@types/node": "^16.11.36",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.4",
"babel-loader": "^8.2.3",
"babel-preset-react-app": "^10.0.1",
"color-hash": "^2.0.1",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.5.1",
"css-minimizer-webpack-plugin": "^3.2.0",
"file-loader": "^6.2.0",
"html-webpack-inline-source-plugin": "^0.0.10",
"html-webpack-plugin": "^5.5.0",
"jest": "^27.4.3",
"jest-resolve": "^27.4.2",
"jest-watch-typeahead": "^1.0.0",
"mini-css-extract-plugin": "^2.4.5",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-scripts": "5.0.1",
"style-loader": "^3.3.1",
"ts-loader": "^9.3.0",
"typescript": "^4.6.4",
"web-vitals": "^2.1.4"
"web-vitals": "^2.1.4",
"webpack": "^5.64.4",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.6.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
"start": "webpack-dev-server",
"build": "webpack",
"test": "jest"
},
"browserslist": {
"production": [
@@ -43,5 +54,24 @@
},
"devDependencies": {
"@types/color-hash": "^1.0.2"
},
"jest": {
"moduleFileExtensions": [
"web.js",
"js",
"web.ts",
"ts",
"web.tsx",
"tsx",
"json",
"web.jsx",
"jsx",
"node"
]
},
"babel": {
"presets": [
"react-app"
]
}
}

View File

@@ -3,12 +3,12 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png">
<link rel="manifest" href="%PUBLIC_URL%/site.webmanifest">
<link rel="mask-icon" href="%PUBLIC_URL%/safari-pinned-tab.svg" color="#cfc4fb">
<link rel="icon" href="<%= require('./favicon.ico') %>" />
<link rel="apple-touch-icon" sizes="180x180" href="<%= require('./apple-touch-icon.png') %>">
<link rel="icon" type="image/png" sizes="32x32" href="<%= require('./favicon-32x32.png') %>">
<link rel="icon" type="image/png" sizes="16x16" href="<%= require('./favicon-16x16.png') %>">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="<%= require('./safari-pinned-tab.svg') %>" color="#cfc4fb">
<meta name="msapplication-TileColor" content="#cfc4fb">
<meta name="theme-color" content="#cfc4fb">
@@ -19,12 +19,12 @@
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- <link rel="apple-touch-icon" href="require('./logo192.png')" /> -->
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- <link rel="manifest" href="require('./manifest.json')" /> -->
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.

View File

@@ -1 +1,71 @@
/// <reference types="react-scripts" />
/// <reference types="node" />
/// <reference types="react" />
/// <reference types="react-dom" />
declare namespace NodeJS {
interface ProcessEnv {
readonly NODE_ENV: 'development' | 'production' | 'test';
readonly PUBLIC_URL: string;
}
}
declare module '*.avif' {
const src: string;
export default src;
}
declare module '*.bmp' {
const src: string;
export default src;
}
declare module '*.gif' {
const src: string;
export default src;
}
declare module '*.jpg' {
const src: string;
export default src;
}
declare module '*.jpeg' {
const src: string;
export default src;
}
declare module '*.png' {
const src: string;
export default src;
}
declare module '*.webp' {
const src: string;
export default src;
}
declare module '*.svg' {
import * as React from 'react';
export const ReactComponent: React.FunctionComponent<React.SVGProps<
SVGSVGElement
> & { title?: string }>;
const src: string;
export default src;
}
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}

View File

@@ -17,7 +17,7 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"noEmit": false,
"jsx": "react-jsx"
},
"include": [

64
webpack.config.js Normal file
View File

@@ -0,0 +1,64 @@
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin')
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
module.exports = {
entry: ['./src/index.tsx'],
mode: 'development',
output: {
path: path.resolve(__dirname, 'build'),
publicPath: '/',
},
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx', '.json'],
},
module: {
rules: [
{ test: /\.tsx?$/, loader: 'ts-loader' },
{
test: /\.js$/,
loader: 'babel-loader'
},
{
test: /\.(png|svg|jpg|gif|ico)$/,
loader: 'file-loader',
options: {
// publicPath: 'build',
esModule: false,
}
},
{
test: /\.css$/,
// exclude: /node_modules/,
use: [{
loader: MiniCssExtractPlugin.loader,
}, 'css-loader',]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html',
filename: 'index.html',
inlineSource: '.(js|css)',
}),
new MiniCssExtractPlugin({
filename: 'styles.css',
}),
new CopyPlugin({
patterns: [
{ from: './public/manifest.json', to: 'manifest.json' },
],
}),
// new HtmlWebpackInlineSourcePlugin(),
],
optimization: {
minimizer: [
`...`,
new CssMinimizerPlugin(),
],
},
}