sourcemap-publisher
TypeScript icon, indicating that this package has built-in type declarations

0.13.0 • Public • Published

sourcemap-publisher

A tool to publish sourcemaps externally and rewrite sourcemap URLs at pre-publish time.

Install

npm i -D sourcemap-publisher

Usage

npx sourcemap-publisher --provenance

This will do the following:

  • Load the files in your files array in package.json
  • Find the sourcemaps any of these files reference
  • Package up these sourcemaps under {packageName}@{version}-sourcemaps
  • Rewrite the sourcemap URLs in the original sources to point at a CDN for this sourcemap package

You should run this command after your build, but before you publish.

Example setup

It is important to get the ordering right so you do not overwrite the rewritten sourcemap URLs.

Generally, the order should be as follows:

  • Build your package
  • Run sourcemap-publisher to publish the sourcemaps and rewrite the URLs
  • Run npm publish to publish the rewritten sources

You can achieve this through a prepublishOnly script in your package.json:

{
  "scripts": {
    "prepublishOnly": "npm run build && sourcemap-publisher --provenance"
  }
}

Options

Option Description
--provenance Publish to npm with --provenance enabled
--dry-run Do not publish, run npm publish --dry-run

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i sourcemap-publisher

Weekly Downloads

4

Version

0.13.0

License

MIT

Unpacked Size

17.7 kB

Total Files

19

Last publish

Collaborators

  • 43081j