Skip to content

Commit

Permalink
Feature/use vite with swc (#400)
Browse files Browse the repository at this point in the history
* Add vite-env.d.ts

Should have been added with bc99728

* Update readmes

* Use vites SWC plugin
  • Loading branch information
schroda authored Aug 11, 2023
1 parent a3d36bd commit 31dca43
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 330 deletions.
51 changes: 5 additions & 46 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This project is build with [Vite](https://vitejs.dev/)

## Available Scripts

In the project directory, you can run:

### `yarn start`
### `yarn dev`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
Expand All @@ -27,44 +22,8 @@ It correctly bundles React in production mode and optimizes the build for the be
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
See the section about [Building for Production](https://vitejs.dev/guide/build.html) for more information.

### `yarn build` fails to minify
### `yarn preview`

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
Runs the app in a local preview production build
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Everything from https://github.com/Suwayomi/Tachidesk-Server/blob/master/CONTRIBUTING.md#where-should-i-start applies here.

## About this project
This is a `create-react-app` project, you can find it's readme in [BUILDING.md](./BUILDING.md)

### Building the app
See [BUILDING.md](./BUILDING.md) for more information

## Release process
1. Update the changelog
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"version": "0.1.0",
"private": true,
"scripts": {
"start": "vite",
"dev": "vite",
"preview": "vite preview",
"build": "vite build",
"serve": "vite preview",
"test": "node -e \"console.log('imagine')\"",
"build-md5": "find build -type f | sort | xargs md5sum | awk '{ print $1 }' | tr -d '\n' | md5sum| awk '{ print $1 }' > buildZip/md5sum ",
"build-zip": "cd build && rev=$(git rev-list HEAD --count) && echo r$rev > revision && zip -9 -r ../buildZip/Tachidesk-WebUI-r$rev *",
"lint": "eslint src --ext .ts,.tsx,.js,.jsx",
Expand All @@ -29,7 +30,7 @@
"@fontsource/roboto": "^5.0.2",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.3",
"@vitejs/plugin-react": "^4.0.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"axios": "^1.4.0",
"file-selector": "^0.6.0",
"i18next": "^23.2.7",
Expand Down
2 changes: 1 addition & 1 deletion src/react-app-env.d.ts → src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

/// <reference types="react-scripts" />
/// <reference types="vite/client" />
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import react from '@vitejs/plugin-react-swc';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import path from 'path';

export default defineConfig(() => ({
build: {
Expand Down
Loading

0 comments on commit 31dca43

Please sign in to comment.