1.0.8 • Published 5 years ago
twpack v1.0.8
twpack
tiny webpack tool
Install
npm install twpack
Usage
1. command line
npm install twpack -g
//a test.js file as below
// function isPowerOf2(value) {
// return (value & (value - 1)) == 0;
// }
// function isSeven(value) {
// return (value === 7);
// }
// module.exports = {
// isPowerOf2 : isPowerOf2,
// isSeven : isSeven
// }
twpack test.js
//will generate a _test.js as below
// function webpackUniversalModuleDefinition(root, factory) {...some code...}
// function modules(modules) {...some code...}
// function module(module, exports, __webpack_require__) {
// ...
// function isPowerOf2(value) {
// return (value & (value - 1)) == 0;
// }
// function isSeven(value) {
// return (value === 7);
// }
// module.exports = {
// isPowerOf2 : isPowerOf2,
// isSeven : isSeven
// }
// ...
// }
// function wrap() {...some code...}
// webpackUniversalModuleDefinition(this,wrap)
//and then can be used either in node or in webbrowser
2. as a package
npm install twpack
var twpack = require("twpack")
var code = twpack.pack(srcFileName,dstFileName)