šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.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
Version published
Weekly downloads
5.9K
10.44%
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

uglify

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