Skip to content

Setup Vite config for npm and Laravel packages#108

Merged
YvetteNikolov merged 16 commits into
mainfrom
feat/first-setup-vite-packages
Apr 9, 2026
Merged

Setup Vite config for npm and Laravel packages#108
YvetteNikolov merged 16 commits into
mainfrom
feat/first-setup-vite-packages

Conversation

@YvetteNikolov
Copy link
Copy Markdown
Contributor

@YvetteNikolov YvetteNikolov commented Apr 9, 2026

Twee standaard Vite configs toegevoegd voor Laravel packages en NPM packages. Ik wil deze morgen toelichten.

laravelPackageConfig

import { laravelPackageConfig } from '@yardinternet/vite-config';

export default laravelPackageConfig( {
    entryPoints: {
        index: 'src/index.ts',
    },
} );

npmPackageConfig

import { npmPackageConfig } from '@yardinternet/vite-config';

export default npmPackageConfig( {
    entryPoints: {
        gallery: 'src/index.ts',
    },
} );

// of meerdere entry points
export default npmPackageConfig( {
    entryPoints: {
        frontend: 'src/frontend.ts',
        editor: 'src/editor.ts',
    },
} );

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 createBasePackageConfig plus npmPackageConfig and laravelPackageConfig wrappers.
  • Added helpers for normalizing entry points, generating output filenames, and validating package.json exports.
  • 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-dts is added as a dependency, but typescript is not declared as a peer dependency here. Since vite-plugin-dts expects TypeScript to be installed by the consumer, consider adding typescript to peerDependencies (optionally with peerDependenciesMeta.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"
	},

Comment thread packages/vite-config/src/utils/package-json.js Outdated
Comment thread packages/vite-config/src/utils/package-json.js Outdated
Comment thread packages/vite-config/src/configs/base-package.js
Comment thread packages/vite-config/src/configs/base-package.js Outdated
Comment thread packages/vite-config/package.json Outdated
Comment thread packages/vite-config/package.json Outdated
@YvetteNikolov
Copy link
Copy Markdown
Contributor Author

Ik merge deze alvast even want het testen zonder versie is onmogelijk.

@YvetteNikolov YvetteNikolov merged commit 3e34014 into main Apr 9, 2026
1 check passed
@YvetteNikolov YvetteNikolov deleted the feat/first-setup-vite-packages branch April 9, 2026 13:39
Copy link
Copy Markdown
Contributor

@FreakyWizard FreakyWizard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants