refactor: update hopp-ui to be independent (#2927)

Co-authored-by: Anwarul Islam <anwaarulislaam@gmail.com>
This commit is contained in:
Andrew Bastin
2023-02-24 13:20:12 +05:30
committed by GitHub
parent 82c6f6f6bc
commit cae1840506
165 changed files with 2134 additions and 2069 deletions

View File

@@ -1,60 +1,40 @@
import vue from "@vitejs/plugin-vue"
import dts from "vite-plugin-dts"
import path from "path"
import { FileSystemIconLoader } from "unplugin-icons/loaders"
import IconResolver from "unplugin-icons/resolver"
import Icons from "unplugin-icons/vite"
import Components from "unplugin-vue-components/vite"
import { defineConfig } from "vite"
import WindiCSS from "vite-plugin-windicss"
module.exports = defineConfig({
export default defineConfig({
plugins: [
vue(),
dts({
insertTypesEntry: true,
skipDiagnostics: true,
outputDir: ['dist']
}),
WindiCSS({
root: path.resolve(__dirname),
}),
Components({
dts: "./src/components.d.ts",
dirs: ["./src/components"],
directoryAsNamespace: true,
resolvers: [
IconResolver({
prefix: "icon",
customCollections: ["hopp", "auth", "brands"],
}),
],
}),
Icons({
compiler: "vue3",
customCollections: {
hopp: FileSystemIconLoader("../hoppscotch-common/assets/icons"),
auth: FileSystemIconLoader("../hoppscotch-common/assets/icons/auth"),
brands: FileSystemIconLoader(
"../hoppscotch-common/assets/icons/brands"
),
},
compiler: "vue3"
}),
], // to process SFC
build: {
sourcemap: true,
minify: false,
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "hopp-ui",
formats: ["es"], // adding 'umd' requires globals set to every external module
fileName: (format) => `hopp-ui.${format}.js`,
formats: ["es"],
fileName: (format, entry) => `${entry}.${format}.js`,
},
rollupOptions: {
// external modules won't be bundled into HoppUI library
external: ["vue"], // not every external has a global
external: ["vue", "vue-router"],
output: {
// disable warning on src/index.ts using both default and named export
exports: "named",
// Provide global variables to use in the UMD build
// for externalized deps (not useful if 'umd' is not in lib.formats)
globals: {
vue: "Vue",
},
},
},
emptyOutDir: false, // to retain the types folder generated by tsc
emptyOutDir: true
},
})