sdk/vite.config.ts

55 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-10-09 13:14:29 +00:00
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
2023-10-09 14:42:46 +00:00
import scopeTailwind from "vite-plugin-scope-tailwind";
2023-10-09 13:14:29 +00:00
import { resolve } from "path";
import svgr from "vite-plugin-svgr";
import dts from "vite-plugin-dts";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import optimizer from "vite-plugin-optimizer";
// https://vitejs.dev/config/
export default defineConfig({
2023-10-08 15:03:26 +00:00
plugins: [
svgr(),
react(),
2023-10-09 14:42:46 +00:00
scopeTailwind({ react: true }),
2023-10-08 15:03:26 +00:00
dts({
2023-10-09 13:14:29 +00:00
tsconfigPath: "tsconfig.build.json",
}),
optimizer({
"node-fetch":
"const e = undefined; export default e;export {e as Response, e as FormData, e as Blob};",
}),
nodePolyfills({
exclude: ["fs"],
globals: { Buffer: true, global: true, process: true },
2023-10-08 15:03:26 +00:00
}),
// css({ output: 'styles/globals.css' })
],
resolve: {
2023-10-09 13:14:29 +00:00
dedupe: ["@lumeweb/libportal", "@lumeweb/libweb", "@lumeweb/libkernel"],
2023-10-07 16:29:36 +00:00
// TODO: For some reason aliases are not working....
// alias: {
// '@styles/': resolve(__dirname, './styles'),
// '@components/': resolve(__dirname, './src/components'),
// '@assets/': resolve(__dirname, './src/assets'),
// '@': resolve(__dirname, './src'),
// },
},
build: {
2023-10-09 14:42:46 +00:00
manifest: false,
outDir: "lib",
2023-10-07 16:29:36 +00:00
emptyOutDir: true,
sourcemap: true,
2023-10-09 13:14:29 +00:00
minify: false,
2023-10-08 15:03:26 +00:00
lib: {
2023-10-09 14:42:46 +00:00
entry: resolve(__dirname, "src/index.ts"),
name: "sdk",
2023-10-09 13:14:29 +00:00
fileName: (format) => `lib.${format}.js`,
2023-10-08 15:03:26 +00:00
},
rollupOptions: {
2023-10-09 14:42:46 +00:00
external: ["react", "react-dom"],
2023-10-09 13:14:29 +00:00
},
},
});