@promoboxx/react-scripts-vite 0.1.16 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -0
- package/dist/client.d.ts +3 -0
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# react-scripts-vite
|
|
2
|
+
|
|
3
|
+
An almost drop-in replacement for react-scripts, but based on Vite.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- svgr
|
|
8
|
+
- TypeScript `paths`
|
|
9
|
+
- TypeScript type checking
|
|
10
|
+
- ESLint linting
|
|
11
|
+
- `process.env`
|
|
12
|
+
- Vitest
|
|
13
|
+
|
|
14
|
+
## Getting Started
|
|
15
|
+
|
|
16
|
+
Install `@promoboxx/react-scripts-vite`:
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
npm install --save-dev @promoboxx/react-scripts-vite
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Edit your `vite.config.ts`:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { viteConfig } from '@promoboxx/react-scripts-vite'
|
|
26
|
+
|
|
27
|
+
export default viteConfig
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If you're using TypeScript, you'll want to load the client types. This will clear up any errors when accessing `import.meta.hot`, or when importing an image.
|
|
31
|
+
|
|
32
|
+
Put this in `src/react-scripts-vite.d.ts`:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
/// <reference types="@promoboxx/react-scripts-vite/dist/client" />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Migrating from react-scripts
|
|
39
|
+
|
|
40
|
+
Should be very straightforward. For application code, everything should be supported out of the box.
|
|
41
|
+
|
|
42
|
+
### index.html
|
|
43
|
+
|
|
44
|
+
Vite expects your `index.html` to live at the root directory, not in `public/`
|
|
45
|
+
|
|
46
|
+
```shell
|
|
47
|
+
mv public/index.html ./
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Remove any references to `%PUBLIC_URL%`. Passing `--base /some/sub/dir/` to `build` will get you the same result.
|
|
51
|
+
|
|
52
|
+
### Sass
|
|
53
|
+
|
|
54
|
+
Sass isn't included [as per Vite's recommendation](https://vitejs.dev/guide/features.html#css-pre-processors). You can add pre-processors to your projects if you wish.
|
|
55
|
+
|
|
56
|
+
### Tests
|
|
57
|
+
|
|
58
|
+
react-scripts-vite uses [Vitest](https://vitest.dev) instead of Jest. Vitest has a jest-compatible interface, accessible via `vi`.
|
|
59
|
+
|
|
60
|
+
The path to the test setup file has changed:
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
mkdir -p src/tests/
|
|
64
|
+
mv src/setupTests.ts src/test/setup.ts
|
|
65
|
+
```
|
package/dist/client.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promoboxx/react-scripts-vite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist/cli.d.ts",
|
|
31
|
+
"dist/client.d.ts",
|
|
31
32
|
"dist/cli.js",
|
|
32
33
|
"dist/index.d.ts",
|
|
33
34
|
"dist/index.js",
|