From c2164398e0d3cf39a579f961571cc184a75b9698 Mon Sep 17 00:00:00 2001 From: Andrei Luca <1881266+iamandrewluca@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:39:31 +0200 Subject: [PATCH] chore: add lib build config --- package-lock.json | 18 ++++++++++++++++++ package.json | 14 +++++++++++++- vite.config.ts | 16 ++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 28b632e..e168bb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ }, "devDependencies": { "@allindevelopers/prettier-config": "^1.0.0", + "@types/node": "^22.8.5", "@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue-jsx": "^4.0.1", "prettier": "^3.3.3", @@ -1155,6 +1156,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.8.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.5.tgz", + "integrity": "sha512-5iYk6AMPtsMbkZqCO1UGF9W5L38twq11S2pYWkybGHH2ogPUvXWNlQqJBzuEZWKj/WRH+QTeiv6ySWqJtvIEgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.8" + } + }, "node_modules/@vitejs/plugin-vue": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.1.4.tgz", @@ -1896,6 +1907,13 @@ "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", diff --git a/package.json b/package.json index fa2d836..83dd1c5 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,19 @@ { - "name": "vue-local-scope", + "name": "@allindevelopers/vue-local-scope", "private": true, "version": "0.0.0", "type": "module", + "files": [ + "dist" + ], + "main": "./dist/vue-local-scope.umd.cjs", + "module": "./dist/vue-local-scope.js", + "exports": { + ".": { + "import": "./dist/vue-local-scope.js", + "require": "./dist/vue-local-scope.umd.cjs" + } + }, "scripts": { "dev": "vite", "build": "vue-tsc -b && vite build", @@ -13,6 +24,7 @@ }, "devDependencies": { "@allindevelopers/prettier-config": "^1.0.0", + "@types/node": "^22.8.5", "@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue-jsx": "^4.0.1", "prettier": "^3.3.3", diff --git a/vite.config.ts b/vite.config.ts index cc424d9..aa255d8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,3 +1,4 @@ +import { resolve } from "node:path"; import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import vueJsx from "@vitejs/plugin-vue-jsx"; @@ -5,4 +6,19 @@ import vueJsx from "@vitejs/plugin-vue-jsx"; // https://vite.dev/config/ export default defineConfig({ plugins: [vue(), vueJsx()], + build: { + lib: { + entry: resolve(__dirname, "lib/index.ts"), + name: "VueLocalScope", + fileName: "vue-local-scope", + }, + rollupOptions: { + external: ["vue"], + output: { + globals: { + vue: "Vue", + }, + }, + }, + }, });