@transclusion/bundle

1.0.6 • Public • Published

@transclusion/bundle

Simple and efficient file bundling for Node.js.

yarn add @transclusion/bundle --dev

build status npm version

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)
})

Readme

Keywords

none

Package Sidebar

Install

npm i @transclusion/bundle

Weekly Downloads

1

Version

1.0.6

License

MIT

Last publish

Collaborators

  • mariuslundgard