@tanem/remove-source-map-url-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

remove-source-map-url-webpack-plugin

npm version build status coverage status npm downloads

A webpack plugin that removes source map URLs.

The problem

You want to send bundled files plus their external source maps to third-party monitoring services, but don't want to expose source maps to browser development tools.

This solution

This webpack plugin removes source map URLs from files in the output path when the build is done.

💡Using devtool: 'hidden-source-map' is a simpler way of achieving the same result. Try that before reaching for this plugin!

Basic Usage

const RemoveSourceMapUrlWebpackPlugin = require('@tanem/remove-source-map-url-webpack-plugin')
const path = require('path')

module.exports = {
  mode: 'development',
  entry: './foo.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'foo.bundle.js'
  },
  plugins: [new RemoveSourceMapUrlWebpackPlugin()]
}

API

Arguments

  • options - Optional An object containing the optional arguments defined below. Defaults to {}.
    • fileNameRegex - Optional The regex used to filter files found within the output path. Defaults to /\.(js|css)$/.

Example

const RemoveSourceMapUrlWebpackPlugin = require('@tanem/remove-source-map-url-webpack-plugin')
const path = require('path')

module.exports = {
  mode: 'development',
  entry: './foo.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'foo.bundle.js'
  },
  plugins: [new RemoveSourceMapUrlWebpackPlugin({ fileNameRegex: /\.js$/ })]
}

Installation

⚠️This library requires Node.js 8 or greater.

$ npm install @tanem/remove-source-map-url-webpack-plugin --save-dev

License

MIT

Package Sidebar

Install

npm i @tanem/remove-source-map-url-webpack-plugin

Weekly Downloads

44

Version

1.0.13

License

MIT

Unpacked Size

22.9 kB

Total Files

10

Last publish

Collaborators

  • tanem