@jmlweb/vite-config 0.1.0 → 0.1.2
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 +105 -26
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @jmlweb/vite-config
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 21918eb: Standardize repository field format to object format across all packages and configure syncpack to preserve it.
|
|
8
|
+
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2208f74: Standardize repository field format to object format across all packages and configure syncpack to preserve it.
|
|
14
|
+
|
|
3
15
|
## 0.1.0
|
|
4
16
|
|
|
5
17
|
### Minor 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,7 @@ For React projects, also install the React plugin:
|
|
|
28
28
|
npm install --save-dev @vitejs/plugin-react
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## Quick Start
|
|
31
|
+
## 🚀 Quick Start
|
|
32
32
|
|
|
33
33
|
Create a `vite.config.ts` file in your project root:
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ import { createViteConfig } from '@jmlweb/vite-config';
|
|
|
38
38
|
export default createViteConfig();
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
## Examples
|
|
41
|
+
## 💡 Examples
|
|
42
42
|
|
|
43
43
|
### Basic Setup
|
|
44
44
|
|
|
@@ -179,7 +179,7 @@ export default createViteConfig({
|
|
|
179
179
|
});
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
## Configuration Details
|
|
182
|
+
## 📋 Configuration Details
|
|
183
183
|
|
|
184
184
|
### Default Settings
|
|
185
185
|
|
|
@@ -227,30 +227,109 @@ Creates a Vite configuration optimized for React applications.
|
|
|
227
227
|
|
|
228
228
|
**Returns:** A complete Vite `UserConfig` object with React plugin included.
|
|
229
229
|
|
|
230
|
-
####
|
|
230
|
+
#### Exported Constants
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
- `BASE_DEFAULTS` - Default configuration values for reference
|
|
233
|
+
- `UserConfig`, `Plugin` - Re-exported from Vite
|
|
233
234
|
|
|
234
|
-
|
|
235
|
+
## 🎯 When to Use
|
|
235
236
|
|
|
236
|
-
|
|
237
|
+
Use this configuration when you want:
|
|
237
238
|
|
|
238
|
-
|
|
239
|
+
- ✅ Consistent Vite configuration across multiple projects
|
|
240
|
+
- ✅ Optimized build settings out of the box
|
|
241
|
+
- ✅ Easy integration with React and other plugins
|
|
242
|
+
- ✅ Type-safe configuration with full TypeScript support
|
|
243
|
+
- ✅ A clean, simple API for customization
|
|
239
244
|
|
|
240
|
-
|
|
245
|
+
## 🔧 Extending the Configuration
|
|
246
|
+
|
|
247
|
+
You can extend the configuration for your specific needs:
|
|
248
|
+
|
|
249
|
+
### Adding Custom Plugins
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
// vite.config.ts
|
|
253
|
+
import { createViteConfig } from '@jmlweb/vite-config';
|
|
254
|
+
import react from '@vitejs/plugin-react';
|
|
255
|
+
import svgr from 'vite-plugin-svgr';
|
|
256
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
257
|
+
|
|
258
|
+
export default createViteConfig({
|
|
259
|
+
plugins: [react(), svgr(), visualizer({ open: true })],
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Overriding Build Settings
|
|
241
264
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
265
|
+
```typescript
|
|
266
|
+
// vite.config.ts
|
|
267
|
+
import { createViteConfig } from '@jmlweb/vite-config';
|
|
268
|
+
|
|
269
|
+
export default createViteConfig({
|
|
270
|
+
build: {
|
|
271
|
+
sourcemap: true,
|
|
272
|
+
minify: 'terser',
|
|
273
|
+
rollupOptions: {
|
|
274
|
+
output: {
|
|
275
|
+
manualChunks: {
|
|
276
|
+
vendor: ['react', 'react-dom'],
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Environment-Specific Configuration
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
// vite.config.ts
|
|
288
|
+
import { createViteConfig } from '@jmlweb/vite-config';
|
|
289
|
+
import react from '@vitejs/plugin-react';
|
|
290
|
+
|
|
291
|
+
export default createViteConfig({
|
|
292
|
+
plugins: [react()],
|
|
293
|
+
build: {
|
|
294
|
+
sourcemap: process.env.NODE_ENV !== 'production',
|
|
295
|
+
},
|
|
296
|
+
server: {
|
|
297
|
+
proxy: {
|
|
298
|
+
'/api': 'http://localhost:3001',
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
});
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## 📝 Usage with Scripts
|
|
305
|
+
|
|
306
|
+
Add build scripts to your `package.json`:
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"scripts": {
|
|
311
|
+
"dev": "vite",
|
|
312
|
+
"build": "vite build",
|
|
313
|
+
"preview": "vite preview",
|
|
314
|
+
"typecheck": "tsc --noEmit"
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Then run:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
npm run dev # Start development server
|
|
323
|
+
npm run build # Build for production
|
|
324
|
+
npm run preview # Preview production build
|
|
325
|
+
```
|
|
247
326
|
|
|
248
|
-
## Requirements
|
|
327
|
+
## 📋 Requirements
|
|
249
328
|
|
|
250
329
|
- **Node.js** >= 18.0.0
|
|
251
330
|
- **Vite** >= 5.0.0
|
|
252
331
|
|
|
253
|
-
## Peer Dependencies
|
|
332
|
+
## 📦 Peer Dependencies
|
|
254
333
|
|
|
255
334
|
This package requires the following peer dependency:
|
|
256
335
|
|
|
@@ -260,13 +339,13 @@ Optional peer dependency for React projects:
|
|
|
260
339
|
|
|
261
340
|
- `@vitejs/plugin-react` (for React integration)
|
|
262
341
|
|
|
263
|
-
## Related Packages
|
|
342
|
+
## 🔗 Related Packages
|
|
264
343
|
|
|
265
344
|
- [`@jmlweb/tsconfig-react`](../tsconfig-react) - TypeScript config for React projects
|
|
266
345
|
- [`@jmlweb/eslint-config-react`](../eslint-config-react) - ESLint config for React projects
|
|
267
346
|
- [`@jmlweb/vitest-config`](../vitest-config) - Vitest configuration for testing
|
|
268
347
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
|
|
269
348
|
|
|
270
|
-
## License
|
|
349
|
+
## 📄 License
|
|
271
350
|
|
|
272
351
|
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.2",
|
|
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",
|
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
],
|
|
33
33
|
"author": "jmlweb",
|
|
34
34
|
"license": "MIT",
|
|
35
|
-
"repository":
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/jmlweb/tooling.git"
|
|
38
|
+
},
|
|
36
39
|
"bugs": "https://github.com/jmlweb/tooling/issues",
|
|
37
40
|
"homepage": "https://github.com/jmlweb/tooling/tree/main/packages/vite-config#readme",
|
|
38
41
|
"engines": {
|