Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed Sep 9, 2022
1 parent dd8c9fa commit 3adf6ca
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { babel } from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";

let bundles = [
{
"file": "dist/color.global.js",
"format": "iife",
"sourcemap": true,
"name": "Color"
file: "dist/color.global.js",
format: "iife",
sourcemap: true,
name: "Color",
},
{
"file": "dist/color.js",
"format": "esm",
"sourcemap": true,
file: "dist/color.js",
format: "esm",
sourcemap: true,
},
{
"file": "dist/color.cjs",
"format": "cjs",
"sourcemap": true,
"exports": "named",
file: "dist/color.cjs",
format: "cjs",
sourcemap: true,
exports: "named",
},
];

// Add minified versions of every bundle
bundles = bundles.flatMap(bundle => {
bundles = bundles.flatMap((bundle) => {
let minBundle = Object.assign({}, bundle);
minBundle.file = minBundle.file.replace(/\.\w+$/, ".min$&");
minBundle.plugins ||= [];
minBundle.plugins.push(terser({
compress: true,
mangle: true
}));
minBundle.plugins.push(
terser({
compress: true,
mangle: true,
})
);

return [bundle, minBundle];
});

export default {
input: "src/index.js",
output: bundles,
plugins: [commonjs(), nodeResolve(), babel({ babelHelpers: 'bundled', exclude: 'node_modules/**' })],
onwarn (warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
plugins: [
commonjs(),
nodeResolve(),
babel({ babelHelpers: "bundled", exclude: "node_modules/**" }),
],
onwarn(warning, rollupWarn) {
if (warning.code !== "CIRCULAR_DEPENDENCY") {
rollupWarn(warning);
}
}
},
};

0 comments on commit 3adf6ca

Please sign in to comment.