@jmlweb/vite-config 0.1.1 → 0.1.3
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 +132 -26
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @jmlweb/vite-config
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6b73301: Add changelog section with link to CHANGELOG.md in package READMEs
|
|
8
|
+
|
|
9
|
+
## 0.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 21918eb: Standardize repository field format to object format across all packages and configure syncpack to preserve it.
|
|
14
|
+
|
|
3
15
|
## 0.1.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
|
|
8
8
|
> Base Vite configuration for jmlweb projects. Provides sensible defaults for TypeScript support, build optimization, and development server settings.
|
|
9
9
|
|
|
10
|
-
## Features
|
|
10
|
+
## ✨ Features
|
|
11
11
|
|
|
12
|
-
- **Sensible Defaults**: Pre-configured with optimized build and dev server settings
|
|
13
|
-
- **TypeScript Support**: Works seamlessly with TypeScript projects
|
|
14
|
-
- **React Ready**: Optional React integration via plugin injection
|
|
15
|
-
- **Path Aliases**: Easy configuration for module path resolution
|
|
16
|
-
- **Clean API**: Simple functions to create configurations
|
|
17
|
-
- **Fully Typed**: Complete TypeScript support with exported types
|
|
12
|
+
- 🎯 **Sensible Defaults**: Pre-configured with optimized build and dev server settings
|
|
13
|
+
- 📦 **TypeScript Support**: Works seamlessly with TypeScript projects
|
|
14
|
+
- ⚛️ **React Ready**: Optional React integration via plugin injection
|
|
15
|
+
- 📁 **Path Aliases**: Easy configuration for module path resolution
|
|
16
|
+
- 🔧 **Clean API**: Simple functions to create configurations
|
|
17
|
+
- 🛠️ **Fully Typed**: Complete TypeScript support with exported types
|
|
18
18
|
|
|
19
|
-
## Installation
|
|
19
|
+
## 📦 Installation
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
npm install --save-dev @jmlweb/vite-config vite
|
|
@@ -28,7 +28,9 @@ For React projects, also install the React plugin:
|
|
|
28
28
|
npm install --save-dev @vitejs/plugin-react
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
32
|
+
|
|
33
|
+
## 🚀 Quick Start
|
|
32
34
|
|
|
33
35
|
Create a `vite.config.ts` file in your project root:
|
|
34
36
|
|
|
@@ -38,7 +40,7 @@ import { createViteConfig } from '@jmlweb/vite-config';
|
|
|
38
40
|
export default createViteConfig();
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
## Examples
|
|
43
|
+
## 💡 Examples
|
|
42
44
|
|
|
43
45
|
### Basic Setup
|
|
44
46
|
|
|
@@ -179,7 +181,7 @@ export default createViteConfig({
|
|
|
179
181
|
});
|
|
180
182
|
```
|
|
181
183
|
|
|
182
|
-
## Configuration Details
|
|
184
|
+
## 📋 Configuration Details
|
|
183
185
|
|
|
184
186
|
### Default Settings
|
|
185
187
|
|
|
@@ -227,30 +229,109 @@ Creates a Vite configuration optimized for React applications.
|
|
|
227
229
|
|
|
228
230
|
**Returns:** A complete Vite `UserConfig` object with React plugin included.
|
|
229
231
|
|
|
230
|
-
####
|
|
232
|
+
#### Exported Constants
|
|
233
|
+
|
|
234
|
+
- `BASE_DEFAULTS` - Default configuration values for reference
|
|
235
|
+
- `UserConfig`, `Plugin` - Re-exported from Vite
|
|
231
236
|
|
|
232
|
-
|
|
237
|
+
## 🎯 When to Use
|
|
233
238
|
|
|
234
|
-
|
|
239
|
+
Use this configuration when you want:
|
|
235
240
|
|
|
236
|
-
|
|
241
|
+
- ✅ Consistent Vite configuration across multiple projects
|
|
242
|
+
- ✅ Optimized build settings out of the box
|
|
243
|
+
- ✅ Easy integration with React and other plugins
|
|
244
|
+
- ✅ Type-safe configuration with full TypeScript support
|
|
245
|
+
- ✅ A clean, simple API for customization
|
|
237
246
|
|
|
238
|
-
##
|
|
247
|
+
## 🔧 Extending the Configuration
|
|
239
248
|
|
|
240
|
-
|
|
249
|
+
You can extend the configuration for your specific needs:
|
|
250
|
+
|
|
251
|
+
### Adding Custom Plugins
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
// vite.config.ts
|
|
255
|
+
import { createViteConfig } from '@jmlweb/vite-config';
|
|
256
|
+
import react from '@vitejs/plugin-react';
|
|
257
|
+
import svgr from 'vite-plugin-svgr';
|
|
258
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
259
|
+
|
|
260
|
+
export default createViteConfig({
|
|
261
|
+
plugins: [react(), svgr(), visualizer({ open: true })],
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Overriding Build Settings
|
|
241
266
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
267
|
+
```typescript
|
|
268
|
+
// vite.config.ts
|
|
269
|
+
import { createViteConfig } from '@jmlweb/vite-config';
|
|
270
|
+
|
|
271
|
+
export default createViteConfig({
|
|
272
|
+
build: {
|
|
273
|
+
sourcemap: true,
|
|
274
|
+
minify: 'terser',
|
|
275
|
+
rollupOptions: {
|
|
276
|
+
output: {
|
|
277
|
+
manualChunks: {
|
|
278
|
+
vendor: ['react', 'react-dom'],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
```
|
|
247
285
|
|
|
248
|
-
|
|
286
|
+
### Environment-Specific Configuration
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
// vite.config.ts
|
|
290
|
+
import { createViteConfig } from '@jmlweb/vite-config';
|
|
291
|
+
import react from '@vitejs/plugin-react';
|
|
292
|
+
|
|
293
|
+
export default createViteConfig({
|
|
294
|
+
plugins: [react()],
|
|
295
|
+
build: {
|
|
296
|
+
sourcemap: process.env.NODE_ENV !== 'production',
|
|
297
|
+
},
|
|
298
|
+
server: {
|
|
299
|
+
proxy: {
|
|
300
|
+
'/api': 'http://localhost:3001',
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## 📝 Usage with Scripts
|
|
307
|
+
|
|
308
|
+
Add build scripts to your `package.json`:
|
|
309
|
+
|
|
310
|
+
```json
|
|
311
|
+
{
|
|
312
|
+
"scripts": {
|
|
313
|
+
"dev": "vite",
|
|
314
|
+
"build": "vite build",
|
|
315
|
+
"preview": "vite preview",
|
|
316
|
+
"typecheck": "tsc --noEmit"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Then run:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
npm run dev # Start development server
|
|
325
|
+
npm run build # Build for production
|
|
326
|
+
npm run preview # Preview production build
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## 📋 Requirements
|
|
249
330
|
|
|
250
331
|
- **Node.js** >= 18.0.0
|
|
251
332
|
- **Vite** >= 5.0.0
|
|
252
333
|
|
|
253
|
-
## Peer Dependencies
|
|
334
|
+
## 📦 Peer Dependencies
|
|
254
335
|
|
|
255
336
|
This package requires the following peer dependency:
|
|
256
337
|
|
|
@@ -260,13 +341,38 @@ Optional peer dependency for React projects:
|
|
|
260
341
|
|
|
261
342
|
- `@vitejs/plugin-react` (for React integration)
|
|
262
343
|
|
|
263
|
-
## Related Packages
|
|
344
|
+
## 🔗 Related Packages
|
|
345
|
+
|
|
346
|
+
### Internal Packages
|
|
264
347
|
|
|
265
348
|
- [`@jmlweb/tsconfig-react`](../tsconfig-react) - TypeScript config for React projects
|
|
266
349
|
- [`@jmlweb/eslint-config-react`](../eslint-config-react) - ESLint config for React projects
|
|
267
350
|
- [`@jmlweb/vitest-config`](../vitest-config) - Vitest configuration for testing
|
|
268
351
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
|
|
269
352
|
|
|
270
|
-
|
|
353
|
+
### External Tools
|
|
354
|
+
|
|
355
|
+
- [Vite](https://vite.dev/) - Next-generation frontend tooling
|
|
356
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react) - Official React plugin for Vite
|
|
357
|
+
- [vite-plugin-svgr](https://github.com/pd4d10/vite-plugin-svgr) - SVG to React component transform
|
|
358
|
+
- [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer) - Visualize bundle size
|
|
359
|
+
|
|
360
|
+
## 🔄 Migration Guide
|
|
361
|
+
|
|
362
|
+
### Upgrading to a New Version
|
|
363
|
+
|
|
364
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
365
|
+
|
|
366
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
367
|
+
|
|
368
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
369
|
+
|
|
370
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
371
|
+
|
|
372
|
+
## 📜 Changelog
|
|
373
|
+
|
|
374
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
375
|
+
|
|
376
|
+
## 📄 License
|
|
271
377
|
|
|
272
378
|
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.3",
|
|
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",
|