Practical adventures with Bellissima - U...
# package-development
m
I wonder if this has any legs for reducing the number of places where package name/alias is hardcoded in the
umbraco-extension
setup? Thoughts welcome..
Copy code
json
import { defineConfig } from "vite";
import { readFileSync } from 'fs';
import { resolve } from 'path';

const pkg = JSON.parse(readFileSync(resolve(__dirname, './package.json'), 'utf-8'));
const umbPkg = JSON.parse(readFileSync(resolve(__dirname, './public/umbraco-package.json'), 'utf-8'));
const name: string = pkg.name;
const umbName: string = umbPkg.name;

export default defineConfig({
  build: {
    lib: {
      entry: "src/bundle.manifests.ts", // Bundle registers one or more manifests
      formats: ["es"],
      fileName: name,
    },
    outDir: `../wwwroot/App_Plugins/${umbName}`, // your web component will be saved in this location
    emptyOutDir: true,
    sourcemap: true,
    rollupOptions: {
      external: [/^@umbraco/],
    },
  },
});
ps inspired after watching an old umbComunitty day... where at the time the config seemed to be able to use [name]

https://youtu.be/OwLOtzvx_o4?si=IZEE-Xtr-MDFW4Gt&t=646