README
Dompack-builder - tooling to build with webpack
- Quickly building ES6 examples with a CLI
- API to build webpacks with reasonable default conversion settings
Converting simple webpacks in directories
Create a dompack.json file in the relevant directory, with the following format:
{ "build": {
"entrypoint": "myentrypoint.es"
}
}
Then run dompack-builder <path-to-dompack.json>
to build the webpack. With the following html file the webpack can be loaded:
<html>
<head>
<link href="dompackbuild/ap.css" rel="stylesheet"></link>
<script src="dompackbuild/ap.js"></script>
</head>
<body>
</body>
</html>
The default build directory is ./dompackbuild
, so it is recommended to add that name to your .gitignore.
Programmatically generate webpack configurations
const dompackbuilder = require("dompack-builder");
const webpack = require("webpack");
const config = dompackbuilder(
{ entrypoint: "myentrypoint.es"
, diskpath: "<path-to-package.json>"
, outputpath: "<path-to-output-directory>"
, baseurl: "<url-to-output>" // URL to final output directory
, enablejsx: false // enable jsx
, isdev: false // set to true to skip minify and compression
, babelcache: "<path-to-babelcache-dir>" // optional, but recommended
, omitpolyfills: false // set to true to omit polyfills and babel external helpers from the generated file
, usecheapsourcemap: false
, extrarequires: [] // list of modules/files that need to be loaded before the entrypoint
, nodemodulepaths: [] // All paths with extra node modules
, extraloaders: [] Extra loaders
, extraplugins: [] Extra plugins
, babelenvtarget: Environment target for `@babel/preset-env` preset. Defaults to `{ "targets": "defaults" }`
, babelextraplugins: [] Extra babel plugins
};
let compiler = new webpack(config);
compiler.run((err, status) =>
{
console.log("Compilation finished");
});
Publishing
npm test
npm version patch|minor|major
git push origin
git push origin --tags
npm publish