view vite.config.ts @ 101:76c1a29a328f

repo now demos itself, which runs better than using the nested demo/ project
author drewp@bigasterisk.com
date Fri, 11 Feb 2022 23:24:41 -0800
parents faf7e432f089
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);
  }
});