2.1.5 • Published 6 years ago

@bit/bundler-extractsm v2.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

bit-bundler-extractsm

Greenkeeper badge

bit-bundler plugin for extracting and writing source maps into their own file

usage

install

$ npm install @bit/bundler-extractsm @bit/bundler-minifyjs

bit-bundler example with bit-bundler-minifyjs

The example below will exract the sourcemap generated by the minifier.

The source map file is written to match the output bundle file. So given the output file out.js, the source map file will be written to out.js.map.

var Bitbundler = require("@bit/bundler");

Bitbundler.bundle({
  src: "in.js",
  dest: "out.js"
}, {
  bundler: [
    "@bit/bundler-minifyjs",
    "@bit/bundler-extractsm"
  ]
});

Remove sourcemaps

Removing sourcemaps from your bundle.

You can use bit-bundler-extractsm to remove sourcemaps from your bundle.

var Bitbundler = require("@bit/bundler");

Bitbundler.bundle({
  src: "in.js",
  dest: "out.js"
}, {
  bundler: [
    "@bit/bundler-minifyjs",
    ["@bit/bundler-extractsm", false]
  ]
});

Removing sourcemaps from a particular bundle split.

To remove sourcemaps from a bundle split, you need to specify the name of the bundle. In the example below we remove the sourcemaps from vendor.

var Bitbundler = require("@bit/bundler");

Bitbundler.bundle({
  src: "in.js",
  dest: "out.js"
}, {
  bundler: [
    ["@bit/bundler-splitter", [
      { name: "vendor", dest: "dest/vendor.js", match: { path: /\/node_modules\// } }],
      { name: "renderer", dest: "dest/renderer.js", match: { path: /\/src\/renderer\// } }
    ],
    "@bit/bundler-minifyjs",
    ["@bit/bundler-extractsm", {
      vendor: false
    }]
  ]
});