@promoboxx/react-scripts-vite 0.1.15 → 0.1.18

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,48 @@
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
+ ### Sass
43
+
44
+ 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.
45
+
46
+ ### Tests
47
+
48
+ react-scripts-vite uses Vitest instead of Jest. Vitest has a jest-compatible interface, accessible via `vi`.
@@ -0,0 +1,3 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-svgr/client" />
3
+ /// <reference types="vitest/globals" />
@@ -16,10 +16,8 @@ exports.default = (0, config_1.defineConfig)({
16
16
  },
17
17
  plugins: [
18
18
  // React specific.
19
- // process.env.NODE_ENV !== 'test' && reactRefresh(),
20
19
  (0, plugin_react_1.default)(),
21
20
  (0, vite_plugin_svgr_1.default)(),
22
- // reactJsx(),
23
21
  // import.meta.env -> process.env
24
22
  (0, vite_plugin_env_compatible_1.default)(),
25
23
  // Support TypeScript paths.
@@ -34,12 +32,9 @@ exports.default = (0, config_1.defineConfig)({
34
32
  enableBuild: true,
35
33
  }),
36
34
  ],
37
- resolve: {
38
- alias: {
39
- // This fixes weird styling issues with material-ui.
40
- '@material-ui/core': '@material-ui/core/esm',
41
- '@material-ui/icons': '@material-ui/icons/esm',
42
- },
35
+ server: {
36
+ open: true,
37
+ host: '0.0.0.0',
43
38
  },
44
39
  test: {
45
40
  globals: true,
@@ -47,54 +42,4 @@ exports.default = (0, config_1.defineConfig)({
47
42
  setupFiles: './src/test/setup.ts',
48
43
  },
49
44
  });
50
- //
51
- //
52
- //
53
- //
54
- //
55
- //
56
- //
57
- //
58
- //
59
- // import react from '@vitejs/plugin-react'
60
- // import { UserConfig } from 'vite'
61
- // import pluginChecker from 'vite-plugin-checker'
62
- // import envCompatible from 'vite-plugin-env-compatible'
63
- // import svgr from 'vite-plugin-svgr'
64
- // import tsconfigPaths from 'vite-tsconfig-paths'
65
- // const viteConfig: UserConfig = {
66
- // build: {
67
- // outDir: 'build',
68
- // sourcemap: true,
69
- // },
70
- // plugins: [
71
- // // React specific.
72
- // react(),
73
- // svgr(),
74
- // // import.meta.env -> process.env
75
- // envCompatible(),
76
- // // Support TypeScript paths.
77
- // tsconfigPaths(),
78
- // // Check for issues.
79
- // // TODO
80
- // // https://github.com/fi3ework/vite-plugin-checker/issues/68
81
- // pluginChecker({
82
- // eslint: {
83
- // lintCommand: `eslint --max-warnings=${
84
- // process.env.CI === 'true' ? 0 : -1
85
- // } "./src/**/*.{ts,tsx,js,jsx,mjs}"`,
86
- // },
87
- // typescript: true,
88
- // enableBuild: true,
89
- // }),
90
- // ],
91
- // resolve: {
92
- // alias: {
93
- // // This fixes weird styling issues with material-ui.
94
- // '@material-ui/core': '@material-ui/core/esm',
95
- // '@material-ui/icons': '@material-ui/icons/esm',
96
- // },
97
- // },
98
- // }
99
- // export default viteConfig
100
45
  //# sourceMappingURL=viteConfig.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promoboxx/react-scripts-vite",
3
- "version": "0.1.15",
3
+ "version": "0.1.18",
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",