Setup Vite config for npm and Laravel packages#108
Conversation
…essGlobals params
There was a problem hiding this comment.
Pull request overview
This PR adds reusable Vite config presets to @yardinternet/vite-config to support building distributable “package” bundles (npm packages and Laravel packages) on top of a shared createBasePackageConfig.
Changes:
- Added
createBasePackageConfigplusnpmPackageConfigandlaravelPackageConfigwrappers. - Added helpers for normalizing entry points, generating output filenames, and validating
package.jsonexports. - Exposed a new public subpath export (
@yardinternet/vite-config/packages) and expanded documentation.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/vite-config/src/utils/package-json.js | Adds package.json reading + exports validation/warnings. |
| packages/vite-config/src/utils/package-helpers.js | Adds entry normalization and Rollup output filename helpers. |
| packages/vite-config/src/utils/generate-aliases.js | Refactors export style (named export directly). |
| packages/vite-config/src/packages.js | New barrel export for the package presets/base config. |
| packages/vite-config/src/configs/base-package.js | Introduces shared Vite “package build” config (lib mode, plugins, watch behavior). |
| packages/vite-config/src/configs/npm-package.js | Adds npm package preset wrapper. |
| packages/vite-config/src/configs/laravel-package.js | Adds Laravel package preset wrapper (manifest/public outDir). |
| packages/vite-config/README.md | Documents new package presets and recommended package.json fields. |
| packages/vite-config/package.json | Adds subpath exports and new dependency (vite-plugin-dts). |
| package-lock.json | Lockfile updates for added dependency graph. |
Comments suppressed due to low confidence (1)
packages/vite-config/package.json:37
vite-plugin-dtsis added as a dependency, buttypescriptis not declared as a peer dependency here. Sincevite-plugin-dtsexpects TypeScript to be installed by the consumer, consider addingtypescripttopeerDependencies(optionally withpeerDependenciesMeta.typescript.optional) to make the requirement explicit and avoid pnpm peer resolution issues.
"dependencies": {
"@roots/vite-plugin": "^1.2.3",
"@tailwindcss/vite": "^4.2.0",
"@vitejs/plugin-react": "^5.1.4",
"@yardinternet/vite-plugin-gutenberg-blocks": "^2.5.0",
"laravel-vite-plugin": "^2.1.0",
"postcss-prefixwrap": "^1.57.2",
"vite-plugin-checker": "^0.12.0",
"vite-plugin-dts": "^4.5.4",
"vite-plugin-externals": "^0.6.2"
},
"peerDependencies": {
"vite": "^7.1.2"
},
|
Ik merge deze alvast even want het testen zonder versie is onmogelijk. |
FreakyWizard
left a comment
There was a problem hiding this comment.
Lekker bezig, wellicht is het ook handig om een soort setup of scaffold te maken voor de skeleton-package (zodat er front-end support in komt)
| test = {}, | ||
| manifest = false, | ||
| plugins = [], | ||
| externalizeReact = true, |
There was a problem hiding this comment.
Het is wellicht goed om dit in de documentatie nog wat toe te lichten, voor het geval dat er wellicht ooit onverklaarbare bugs ontstaan omdat react niet gevonden kan worden
Twee standaard Vite configs toegevoegd voor Laravel packages en NPM packages. Ik wil deze morgen toelichten.
laravelPackageConfig
npmPackageConfig