0.1.9 • Published 5 years ago
@atomico/rollup-pack v0.1.9
rollup-pack
This is a bundle prefiguration for Rollup that allows to generate code for the browser in MJS format and to know its cost in size.
The process is simple and is done thanks to @atomico/rollup-plugin-input-html
- the existing html files in the root are analyzed.
- it extracts the local script of the modules type, from the html files.
- Bundles are generated for each one based on the name of the HTML file. eg:
ui-button.html
will beui-button.js
.
through the process 2 bundle directories are generated:
./dist
: copy the html and all its dependencies thanks to rollup-plugin-node-resolve and @atomico/rollup-plugin-input-html../lib
: copy alone the js of export.
In both formats the cost of each bundle is taught thanks to @atomico/rollup-plugin-sizes.
Use
import pack from "@atomico/rollup-pack";
export default pack("*.html" /**,optionalConfig **/);
default configuration
let ignoreLog = ["CIRCULAR_DEPENDENCY", "UNRESOLVED_IMPORT"];
let defaultOptions = {
dirDist: "./dist",
dirDemo: "./lib",
minifyDist: !isDev,
minifyDemo: !isDev,
showSizes: !isDev,
plugins: [],
pluginsDist: [],
pluginsDemo: [],
onwarn(message) {
if (ignoreLog.indexOf(message.code) > -1) return;
console.error(message);
}
};