@transclusion/bundle
v1.0.6
Published
Simple and efficient file bundling for Node.js.
Downloads
10
Readme
@transclusion/bundle
Simple and efficient file bundling for Node.js.
yarn add @transclusion/bundle --dev
Usage
CLI
usage: bundle <command> <options>
Commands:
– build
– watch
When using the CLI, add a .bundlerc
to the project root:
{
"name": "main",
"dest": "./dist",
"source": "src/client",
"target": "[name][ext]",
"plugins": [
["babel", {"presets": ["flow", "env"]}],
"commonjs",
"iife",
"uglifyjs"
]
}
API
bundle
can also be used as a Node.js module.
Example
import bundle from '@transclusion/bundle'
import bundlePluginCommonjs from '@transclusion/bundle-plugin-commonjs'
import bundlePluginIife from '@transclusion/bundle-plugin-iife'
import path from 'path'
bundle.build({
name: 'main',
basedir: __dirname,
dest: path.resolve(__dirname, 'static'),
source: './main.js',
output: '[name][ext]',
plugins: [
bundlePluginCommonjs,
bundlePluginIife
]
}).then(() => {
console.log('bundled main.js')
}).catch(err => {
console.error(err.stack)
process.exit(1)
})