Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terser-loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terser-loader

Terser loader for webpack

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.9K
decreased by-1.16%
Maintainers
1
Weekly downloads
 
Created
Source

npm node deps size

terser-loader

Terser loader for webpack

Getting Started

To begin, you'll need to install terser-loader:

  • Using yarn:
yarn add --dev terser-loader
  • Using npm:
npm install terser-loader --save-dev

Then add the loader to your webpack config. For example:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /.js$/,
        use: ['file-loader', 'terser-loader'],
      },
    ],
  },
};

Another example:

module.exports = {
  module: {
    rules: [
      {
        test: /.js$/,
        use: [
          {
            loader: 'file-loader',
          },
          {
            loader: 'terser-loader',
            options: {
              stripTrailingSemicolon: true,
              terserOptions: {
                minify: {
                  mangle: false,
                },
                output: {
                  inline_script: true,
                },
              },
            },
          },
        ],
      },
    ],
  },
};

Options

terserOptions

Optional, type: object, default: {}

See Terser API Reference for details. terserOptions as passed to Terser API as is.

stripTrailingSemicolon

Optional, type: boolean, default: false

By default, terser'ed output ends with ;. It's generally a good idea if you plan on concatenating produced scripts into a bundle at a later stage. Otherwise, you can safely remove ; by setting stripTrailingSemicolon to true and save yet another byte.

License

MIT

Keywords

FAQs

Package last updated on 27 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc