vamtiger-bundle-typescript

Bundle typescript source into a single file.

Usage no npm install needed!

<script type="module">
  import vamtigerBundleTypescript from 'https://cdn.skypack.dev/vamtiger-bundle-typescript';
</script>

README

VAMTIGER Bundle Typescript

VAMTIGER Bundle Typescript bundles typescript into a single compiled output file.

Installation

VAMTIGER Bundle Typescript can be installed using npm or yarn:

npm i --global vamtiger-bundle-typescript 

or

yarn global vamtiger-bundle-typescript

Usage

VAMTIGER Bundle Typescript can bundle typescript to a single compiled output file:

vamtiger-bundle-typescript --entryFilePath source/index.ts --bundleFilePath build/bundle.js --format cjs --sourcemap inline

The compiled result can also be minified by specifying the minify option:

vamtiger-bundle-typescript --entryFilePath source/index.ts --bundleFilePath build/bundle.js --format cjs --sourcemap inline --minify

The watch option can be added to generate compiled output each time a source file is updated:

vamtiger-bundle-typescript --entryFilePath source/index.ts --bundleFilePath build/bundle.js --format cjs --sourcemap inline --watch

The copyBundleFilePath option will copy the compiled output to a defined path:

vamtiger-bundle-typescript --entryFilePath source/index.ts --bundleFilePath build/bundle.js --format cjs --sourcemap inline --copyBundleFilePath ${PWD}/some/bundle-copy.js

The relativePath option can be used to reference entryFilePath and bundleFilePath relative to the current working directory:

vamtiger-bundle-typescript --relativePath --entryFilePath source/index.ts --bundleFilePath build/bundle.js --format cjs --sourcemap inline --copyBundleFilePath ${PWD}/some/bundle-copy.js

VAMTIGER Bundle Typescript can also be defined as a custom script:

    ...
    scripts: {
        "bundle": "vamtiger-bundle-typescript --relativePath --entryFilePath source/index.ts --bundleFilePath build/bundle.js --format iife --sourcemap inline --minify",
        "watch": "vamtiger-bundle-typescript --relativePath --entryFilePath source/index.ts --bundleFilePath build/bundle.js --format iife --sourcemap inline --minify --watch"
    }
    ...

Output formats of the compiled result include:

  • umd
  • amd
  • system
  • cjs
  • iife

Sourcemap can be set to:

  • inline
  • true
  • false