@jmlweb/vite-config 0.1.2 → 0.1.4
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/CHANGELOG.md +12 -0
- package/README.md +64 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @jmlweb/vite-config
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4a9ece1: Update documentation to use pnpm commands instead of npm
|
|
8
|
+
|
|
9
|
+
## 0.1.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 6b73301: Add changelog section with link to CHANGELOG.md in package READMEs
|
|
14
|
+
|
|
3
15
|
## 0.1.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -19,15 +19,17 @@
|
|
|
19
19
|
## 📦 Installation
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
|
|
22
|
+
pnpm add -D @jmlweb/vite-config vite
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
For React projects, also install the React plugin:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
|
|
28
|
+
pnpm add -D @vitejs/plugin-react
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
32
|
+
|
|
31
33
|
## 🚀 Quick Start
|
|
32
34
|
|
|
33
35
|
Create a `vite.config.ts` file in your project root:
|
|
@@ -179,6 +181,38 @@ export default createViteConfig({
|
|
|
179
181
|
});
|
|
180
182
|
```
|
|
181
183
|
|
|
184
|
+
## 🤔 Why Use This?
|
|
185
|
+
|
|
186
|
+
> **Philosophy**: Modern build tools should provide instant feedback during development and optimized production builds with zero configuration.
|
|
187
|
+
|
|
188
|
+
This package provides a Vite configuration that balances development speed with production optimization. It leverages Vite's native ESM dev server for instant HMR and esbuild for ultra-fast production builds, while remaining flexible enough for any project type.
|
|
189
|
+
|
|
190
|
+
### Design Decisions
|
|
191
|
+
|
|
192
|
+
**ESBuild Minification (`minify: 'esbuild'`)**: Fast production builds
|
|
193
|
+
|
|
194
|
+
- **Why**: esbuild is orders of magnitude faster than terser while producing comparably small bundles. For most projects, the speed improvement far outweighs the minimal size difference. This keeps build times fast even for large applications
|
|
195
|
+
- **Trade-off**: Terser can sometimes achieve slightly smaller bundles (1-3%). But esbuild's speed is almost always worth it
|
|
196
|
+
- **When to override**: For bundle size-critical applications where every byte matters, consider terser. But try esbuild first
|
|
197
|
+
|
|
198
|
+
**ESNext Target (`target: 'esnext'`)**: Modern JavaScript output
|
|
199
|
+
|
|
200
|
+
- **Why**: Vite assumes modern browsers by default. Using esnext target produces the smallest, most performant code because it doesn't transpile modern features browsers already support. Your bundler only polyfills what's actually needed
|
|
201
|
+
- **Trade-off**: Won't work in older browsers without additional configuration. But Vite is designed for modern development
|
|
202
|
+
- **When to override**: For projects supporting older browsers - set specific targets like `['es2020', 'chrome87', 'firefox78']`
|
|
203
|
+
|
|
204
|
+
**No Source Maps by Default (`sourcemap: false`)**: Faster production builds
|
|
205
|
+
|
|
206
|
+
- **Why**: Source maps are valuable for debugging but significantly increase build time and bundle size. Most production deployments don't need them. Enable per-project when needed for production debugging or error tracking services
|
|
207
|
+
- **Trade-off**: Harder to debug production issues. But you can enable source maps easily when needed
|
|
208
|
+
- **When to override**: For production debugging or when using error tracking services (Sentry, etc.) - set `sourcemap: true`
|
|
209
|
+
|
|
210
|
+
**Port Flexibility (`strictPort: false`)**: Development convenience
|
|
211
|
+
|
|
212
|
+
- **Why**: If the default port is in use, Vite automatically finds an available port instead of failing. This is convenient when running multiple projects or when the port is already taken
|
|
213
|
+
- **Trade-off**: Port might change between runs if default is busy. But Vite tells you the actual port
|
|
214
|
+
- **When to override**: For projects that must run on a specific port (e.g., configured in OAuth callbacks) - set `strictPort: true`
|
|
215
|
+
|
|
182
216
|
## 📋 Configuration Details
|
|
183
217
|
|
|
184
218
|
### Default Settings
|
|
@@ -319,9 +353,9 @@ Add build scripts to your `package.json`:
|
|
|
319
353
|
Then run:
|
|
320
354
|
|
|
321
355
|
```bash
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
356
|
+
pnpm dev # Start development server
|
|
357
|
+
pnpm build # Build for production
|
|
358
|
+
pnpm preview # Preview production build
|
|
325
359
|
```
|
|
326
360
|
|
|
327
361
|
## 📋 Requirements
|
|
@@ -341,11 +375,36 @@ Optional peer dependency for React projects:
|
|
|
341
375
|
|
|
342
376
|
## 🔗 Related Packages
|
|
343
377
|
|
|
378
|
+
### Internal Packages
|
|
379
|
+
|
|
344
380
|
- [`@jmlweb/tsconfig-react`](../tsconfig-react) - TypeScript config for React projects
|
|
345
381
|
- [`@jmlweb/eslint-config-react`](../eslint-config-react) - ESLint config for React projects
|
|
346
382
|
- [`@jmlweb/vitest-config`](../vitest-config) - Vitest configuration for testing
|
|
347
383
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
|
|
348
384
|
|
|
385
|
+
### External Tools
|
|
386
|
+
|
|
387
|
+
- [Vite](https://vite.dev/) - Next-generation frontend tooling
|
|
388
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react) - Official React plugin for Vite
|
|
389
|
+
- [vite-plugin-svgr](https://github.com/pd4d10/vite-plugin-svgr) - SVG to React component transform
|
|
390
|
+
- [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer) - Visualize bundle size
|
|
391
|
+
|
|
392
|
+
## 🔄 Migration Guide
|
|
393
|
+
|
|
394
|
+
### Upgrading to a New Version
|
|
395
|
+
|
|
396
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
397
|
+
|
|
398
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
399
|
+
|
|
400
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
401
|
+
|
|
402
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
403
|
+
|
|
404
|
+
## 📜 Changelog
|
|
405
|
+
|
|
406
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
407
|
+
|
|
349
408
|
## 📄 License
|
|
350
409
|
|
|
351
410
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlweb/vite-config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Base Vite configuration for jmlweb projects with TypeScript support, build optimization, and optional React integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|