Replace rollup.config for vite.config

This commit is contained in:
Adria Navarro 2024-11-27 10:59:34 +01:00
parent 9982b5d907
commit f8855bb0c1
2 changed files with 29 additions and 32 deletions

View File

@ -1,32 +0,0 @@
import svelte from "rollup-plugin-svelte"
import resolve from "@rollup/plugin-node-resolve"
import commonjs from "@rollup/plugin-commonjs"
import json from "@rollup/plugin-json"
import { terser } from "rollup-plugin-terser"
import postcss from "rollup-plugin-postcss"
export default {
input: "src/index.js",
output: {
sourcemap: true,
format: "esm",
file: "dist/bbui.es.js",
},
onwarn(warning, warn) {
// suppress eval warnings
if (warning.code === "EVAL") {
return
}
warn(warning)
},
plugins: [
resolve(),
commonjs(),
svelte({
emitCss: true,
}),
postcss(),
terser(),
json(),
],
}

View File

@ -0,0 +1,29 @@
import { defineConfig } from "vite"
import { svelte } from "@sveltejs/vite-plugin-svelte"
import postcss from "postcss"
export default defineConfig({
// https://vite.dev/guide/dep-pre-bundling#monorepos-and-linked-dependencies
optimizeDeps: {
include: ["shared-core"],
},
build: {
sourcemap: true,
lib: {
entry: "src/index.js",
formats: ["es"],
fileName: "bbui.es",
},
commonjsOptions: {
include: [/shared-core/, /node_modules/],
},
},
plugins: [
svelte({
emitCss: true,
}),
],
css: {
postcss,
},
})