1. @surmon-china/libundler
Universal JavaScript library bundler
@surmon-china/libundler
Package: @surmon-china/libundler
Created by: surmon-china
Last modified: Sat, 11 Jun 2022 19:33:31 GMT
Version: 2.3.0
License: MIT
Downloads: 84
Repository: https://github.com/surmon-china/libundler

Install

npm install @surmon-china/libundler
yarn add @surmon-china/libundler

libundler

GitHub stars
 
npm
 
GitHub package.json version
 
GitHub Workflow Status
 
license

📦 Universal JavaScript library bundler, powered by Rollup.


Usage

1. install

 npm install @surmon-china/libundler --save-dev

You can also use yarn or pnpm.

2. add build script to package.json

 "scripts": {
  "build": "libundler"
}

You can also use the command b.

3. run build

 yarn build

Config

By default, you do not need to specify configuration file, libundler will generate a nearly perfect configuration for the bundle according to your package.json.

But if you have more specific needs, you can create libundler.config.js or libundler.config.ts in your project root.

libundler config interface

  • LibundlerConfigObject
  • LibundlerConfigObject[]
  • (defaultRollupConfig) => RollupConfig

config example projects:

object config example:

 // libundler.config.js

/** @type {import('@surmon-china/libundler/lib/interface').LibundlerConfigObject} */
module.exports = {
  entry: 'src/index.js',
  // ...
}

array config example:

 // libundler.config.js

/** @type {import('@surmon-china/libundler/lib/interface').LibundlerConfigArray} */
module.exports = [
  {
    entry: 'src/index.ts',
    // ...
  },
  {
    entry: 'src/entry.ts',
    // ...
  },
]

function config example:

 // libundler.config.js

/** @type {import('@surmon-china/libundler/lib/interface').LibundlerConfigFn} */
module.exports = (rollupConfig) => {
  // overwrite the Rollup config
  rollupConfig.plugins.push(/* ... */)

  // ...
  return rollupConfig
}

esm config example:

 // libundler.config.js
export default {
  entry: 'src/index.js',
  // ...
}

.ts config example:

 // libundler.config.ts
import { defineConfig } from '@surmon-china/libundler'

export default defineConfig({
  entry: 'src/index.js',
  // ...
})

JavaScript API

 const libundler = require('@surmon-china/libundler')

libundler
  .bundle({
    /* LibundlerConfig */
  })
  .then((result) => {
    console.log('bundle success', result)
  })
  .catch((error) => {
    console.log('bundle error', error)
  })

Development

 yarn dev

yarn lint

yarn build

yarn release

Changelog

Detailed changes for each release are documented in the release notes.

License

MIT

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin