diff --git a/vite-plugin-laravel/inertia.d.ts b/vite-plugin-laravel/inertia.d.ts new file mode 100644 index 0000000..8f1ea8d --- /dev/null +++ b/vite-plugin-laravel/inertia.d.ts @@ -0,0 +1 @@ +export * from './dist/inertia' diff --git a/vite-plugin-laravel/package.json b/vite-plugin-laravel/package.json index 223e6b5..3eb9ede 100644 --- a/vite-plugin-laravel/package.json +++ b/vite-plugin-laravel/package.json @@ -3,10 +3,24 @@ "version": "0.2.0-beta.15", "author": "Enzo Innocenzi", "license": "MIT", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "./inertia": { + "import": "./dist/inertia.mjs", + "require": "./dist/inertia.js", + "types": "./dist/inertia.d.ts" + } + }, "main": "dist/index.js", + "module": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "*.d.ts" ], "repository": { "type": "git", @@ -16,7 +30,9 @@ "bugs": "https://github.com/innocenzi/laravel-vite/issues", "scripts": { "prepare": "npm run build", - "build": "tsup src/index.ts", + "build": "npm run build:index && npm run build:inertia", + "build:index": "tsup src/index.ts", + "build:inertia": "tsup src/inertia.ts --no-clean", "test": "vitest" }, "devDependencies": { diff --git a/vite-plugin-laravel/tsup.config.ts b/vite-plugin-laravel/tsup.config.ts index 1dc3e9b..46b7eb7 100644 --- a/vite-plugin-laravel/tsup.config.ts +++ b/vite-plugin-laravel/tsup.config.ts @@ -3,7 +3,7 @@ import type { Options } from 'tsup' export const tsup: Options = { clean: true, dts: true, - format: ['cjs'], + format: ['cjs', 'esm'], external: ['rollup', 'vite', 'esbuild', 'tailwindcss', 'autoprefixer'], noExternal: ['execa'], }