-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
35 lines (31 loc) · 1.14 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// rollup.config.js
import typescript from "@rollup/plugin-typescript";
import {terser} from "rollup-plugin-terser";
import pkg from "./dist/package.json";
const banner = `/* ! ${pkg.name} | v${pkg.version} | ${pkg.description} */`;
const formats = ["es", "cjs"];
const createConfig = (input, outputDir) => {
return formats.map((format) => ({
input: input,
output: {
file: `${outputDir}.${format}.js`,
format: format,
sourcemap: true,
name: "Locus",
banner: banner,
exports: "auto",
plugins: [terser({format: {comments: /locus/}})],
},
plugins: [
// Add your plugins here
typescript({
tsconfig: "./tsconfig.json",
declaration: true,
declarationDir: "dist/lib",
emitDeclarationOnly: true,
}),
// Learn more about plugins from https://rollupjs.org/guide/en/#plugins
],
}));
};
export default [...createConfig("src/array/array.js", "dist/lib/array/array"), ...createConfig("src/string/string.js", "dist/lib/string/string")];