Skip to content

Commit

Permalink
adds rollup (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjanicki2 authored Nov 28, 2023
1 parent 4e30b9b commit 7d5533f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 12 deletions.
36 changes: 26 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"scripts": {
"test": "node test/index.js",
"build:html": "npx @11ty/eleventy --config=_build/.eleventy.cjs",
"build": "npm run build:html",
"build": "npm run build:html && npm run build:js",
"watch:html": "npx @11ty/eleventy --config=_build/.eleventy.cjs --watch",
"watch": "npm run watch:html",
"build:docs": "npx typedoc --out docs src/"
"build:docs": "npx typedoc --out docs src/",
"build:js": "npx rollup -c"
},
"repository": {
"type": "git",
Expand All @@ -34,6 +35,7 @@
"htest.dev": "^0.0.4",
"jsep": "^1.3.8",
"markdown-it-anchor": "^8.6.7",
"rollup": "^2.79.1",
"typedoc": "^0.25.3"
}
}
26 changes: 26 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const BASE_FILENAME = "vastly";
const IIFE_NAME = "Vastly";

function bundle(format, filenameAddition = "") {
let filename = BASE_FILENAME;

if (format !== "esm" && filenameAddition) {
filename += "." + filenameAddition;
}

return {
file: `dist/${filename}.js`,
name: IIFE_NAME,
format,
sourcemap: format !== "esm"
};
}

export default {
input: "src/index.js",
output: [
bundle("iife", "global"),
bundle("esm"),
bundle("cjs", "cjs"),
],
};

0 comments on commit 7d5533f

Please sign in to comment.