@promoboxx/react-scripts-vite 0.1.17 → 0.1.21

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 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 CHANGED
@@ -1,2 +1,3 @@
1
1
  /// <reference types="vite/client" />
2
2
  /// <reference types="vite-plugin-svgr/client" />
3
+ /// <reference types="vitest/globals" />
@@ -11,7 +11,7 @@ var vite_tsconfig_paths_1 = __importDefault(require("vite-tsconfig-paths"));
11
11
  var config_1 = require("vitest/config");
12
12
  exports.default = (0, config_1.defineConfig)({
13
13
  build: {
14
- outDir: 'dist',
14
+ outDir: 'build',
15
15
  sourcemap: true,
16
16
  },
17
17
  plugins: [
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@promoboxx/react-scripts-vite",
3
- "version": "0.1.17",
3
+ "version": "0.1.21",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [],
7
+ "repository": {
8
+ "url": "https://github.com/promoboxx/react-scripts-vite"
9
+ },
7
10
  "bin": {
8
11
  "react-scripts": "./dist/cli.js",
9
12
  "react-scripts-vite": "./dist/cli.js"