Skip to content

Instantly share code, notes, and snippets.

@EpicKiwi
Created March 4, 2023 12:37
Show Gist options
  • Save EpicKiwi/c1ff0d2758a993142226447976837419 to your computer and use it in GitHub Desktop.
Save EpicKiwi/c1ff0d2758a993142226447976837419 to your computer and use it in GitHub Desktop.
Rollup config for dependancies-included Typescript Webcomponents
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import resolve from "@rollup/plugin-node-resolve";
const COMPONENT_NAME = "my-component"
export default {
input: 'src/index.ts',
output: [
{
file: `dist/${COMPONENT_NAME}.esm.js`,
format: 'es',
sourcemap: true
},
{
name: COMPONENT_NAME,
file: `dist/${COMPONENT_NAME}.js`,
format: 'iife',
sourcemap: true
}
],
plugins: [
commonjs({ extensions: ['.js', '.ts'] }),
resolve({browser: true}),
typescript({
compilerOptions: {
module: "esnext",
lib: ["es5", "es6", "es2020", "dom"],
target: "es6",
}
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment