view vite.config.ts @ 111:f08004002444

updates to demo
author drewp@bigasterisk.com
date Fri, 18 Mar 2022 23:42:52 -0700
parents 76c1a29a328f
children 73a70d00fb74
line wrap: on
line source

import { defineConfig, UserConfigExport } from "vite";

const config: UserConfigExport = {
  base: "https://bigasterisk.com/reposyncDev/",
  server: {
    host: "0.0.0.0",
    port: 8001,
    hmr: { port: 443 },
    fs: {
      allow: ["src", "node_modules", "."],
    },
  },
  build: {
    target: "esnext",
    lib: {
      entry: "src/index.ts",
      formats: ["es"],
    },
    rollupOptions: {
      external: /^lit/,
    },
  },
  resolve: {
    alias: [{ find: "rdf-canonize-native", replacement: "" }],
  },
  define: {
    global: {},
  },
};

export default defineConfig(({ command, mode }) => {
  if (command === "serve") {
    (config.define as any)["process"] = { env: {} };
    return config;
  } else if (command === "build") {
    return config;
  } else {
    throw new Error(command);
  }
});