mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
chore(examples): add rollup set-up
This commit is contained in:
parent
d746c9134a
commit
c1b98ced95
11 changed files with 889 additions and 0 deletions
32
examples/rollup/rollup.config.js
Normal file
32
examples/rollup/rollup.config.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { terser } from "rollup-plugin-terser";
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import resolve from "@rollup/plugin-node-resolve";
|
||||
import serve from "rollup-plugin-serve";
|
||||
import svelte from "rollup-plugin-svelte";
|
||||
import livereload from "rollup-plugin-livereload";
|
||||
import sveltePreprocess from "svelte-preprocess";
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
const PROD = !process.env.ROLLUP_WATCH;
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
output: {
|
||||
sourcemap: !PROD,
|
||||
format: "iife",
|
||||
name: "app",
|
||||
file: "public/build/bundle.js",
|
||||
},
|
||||
plugins: [
|
||||
svelte({
|
||||
dev: !PROD,
|
||||
preprocess: sveltePreprocess(),
|
||||
css: (css) => css.write("bundle.css", !PROD),
|
||||
}),
|
||||
resolve({ browser: true, dedupe: ["svelte"] }),
|
||||
commonjs(),
|
||||
!PROD && serve({ contentBase: ["public"], port: PORT }),
|
||||
!PROD && livereload("public"),
|
||||
PROD && terser(),
|
||||
],
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue