 \href{https://github.com/webpack/webpack}{\texttt{  }} 

\href{https://npmjs.com/package/terser-webpack-plugin}{\texttt{ }} \href{https://nodejs.org}{\texttt{ }} \href{https://david-dm.org/webpack-contrib/terser-webpack-plugin}{\texttt{ }} \href{https://dev.azure.com/webpack-contrib/terser-webpack-plugin/_build/latest?definitionId=7&branchName=master}{\texttt{ }} \href{https://codecov.io/gh/webpack-contrib/terser-webpack-plugin}{\texttt{ }} \href{https://gitter.im/webpack/webpack}{\texttt{ }} \href{https://packagephobia.now.sh/result?p=terser-webpack-plugin}{\texttt{ }}\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32991}{}\doxysection{terser-\/webpack-\/plugin}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32991}
This plugin uses \href{https://github.com/terser-js/terser}{\texttt{ terser}} to minify your Java\+Script.

\begin{quote}
ℹ️ For {\ttfamily webpack@3} use \href{https://www.npmjs.com/package/terser-webpack-plugin-legacy}{\texttt{ terser-\/webpack-\/plugin-\/legacy}} package \end{quote}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32992}{}\doxysubsection{Getting Started}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32992}
To begin, you\textquotesingle{}ll need to install {\ttfamily terser-\/webpack-\/plugin}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install terser-\/webpack-\/plugin -\/-\/save-\/dev }

\end{DoxyCode}


Then add the plugin to your {\ttfamily webpack} config. For example\+:

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{const TerserPlugin = require('terser-\/webpack-\/plugin');}
\DoxyCodeLine{}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [new TerserPlugin()],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}


And run {\ttfamily webpack} via your preferred method.\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32993}{}\doxysubsection{Options}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32993}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32994}{}\doxysubsubsection{$<$tt$>$test$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32994}
Type\+: {\ttfamily String$\vert$\+Reg\+Exp$\vert$\+Array$<$String$\vert$\+Reg\+Exp$>$} Default\+: {\ttfamily /\textbackslash{}.m?js(\textbackslash{}?.$\ast$)?\$/i}

Test to match files against.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        test: /\(\backslash\).js(\(\backslash\)?.*)?\$/i,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32995}{}\doxysubsubsection{$<$tt$>$include$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32995}
Type\+: {\ttfamily String$\vert$\+Reg\+Exp$\vert$\+Array$<$String$\vert$\+Reg\+Exp$>$} Default\+: {\ttfamily undefined}

Files to include.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        include: /\(\backslash\)/includes/,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32996}{}\doxysubsubsection{$<$tt$>$exclude$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32996}
Type\+: {\ttfamily String$\vert$\+Reg\+Exp$\vert$\+Array$<$String$\vert$\+Reg\+Exp$>$} Default\+: {\ttfamily undefined}

Files to exclude.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        exclude: /\(\backslash\)/excludes/,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32997}{}\doxysubsubsection{$<$tt$>$chunk\+Filter$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32997}
Type\+: {\ttfamily Function$<$(chunk) -\/$>$ boolean$>$} Default\+: {\ttfamily () =$>$ true}

Allowing to filter which chunks should be uglified (by default all chunks are uglified). Return {\ttfamily true} to uglify the chunk, {\ttfamily false} otherwise.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        chunkFilter: (chunk) => \{}
\DoxyCodeLine{          // Exclude uglification for the `vendor` chunk}
\DoxyCodeLine{          if (chunk.name === 'vendor') \{}
\DoxyCodeLine{            return false;}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{          return true;}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32998}{}\doxysubsubsection{$<$tt$>$cache$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32998}
Type\+: {\ttfamily Boolean$\vert$\+String} Default\+: {\ttfamily false}

Enable file caching. Default path to cache directory\+: {\ttfamily node\+\_\+modules/.cache/terser-\/webpack-\/plugin}.

\begin{quote}
ℹ️ If you use your own {\ttfamily minify} function please read the {\ttfamily minify} section for cache invalidation correctly. \end{quote}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32999}{}\doxyparagraph{$<$tt$>$\+Boolean$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md32999}
Enable/disable file caching.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        cache: true,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33000}{}\doxyparagraph{$<$tt$>$\+String$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33000}
Enable file caching and set path to cache directory.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        cache: 'path/to/cache',}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33001}{}\doxysubsubsection{$<$tt$>$cache\+Keys$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33001}
Type\+: {\ttfamily Function$<$(default\+Cache\+Keys, file) -\/$>$ Object$>$} Default\+: {\ttfamily default\+Cache\+Keys =$>$ default\+Cache\+Keys}

Allows you to override default cache keys.

Default cache keys\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{(\{}
\DoxyCodeLine{  terser: require('terser/package.json').version, // terser version}
\DoxyCodeLine{  'terser-\/webpack-\/plugin': require('../package.json').version, // plugin version}
\DoxyCodeLine{  'terser-\/webpack-\/plugin-\/options': this.options, // plugin options}
\DoxyCodeLine{  path: compiler.outputPath ? `\$\{compiler.outputPath\}/\$\{file\}` : file, // asset path}
\DoxyCodeLine{  hash: crypto}
\DoxyCodeLine{    .createHash('md4')}
\DoxyCodeLine{    .update(input)}
\DoxyCodeLine{    .digest('hex'), // source file hash}
\DoxyCodeLine{\}); }

\end{DoxyCode}


{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        cache: true,}
\DoxyCodeLine{        cacheKeys: (defaultCacheKeys, file) => \{}
\DoxyCodeLine{          defaultCacheKeys.myCacheKey = 'myCacheKeyValue';}
\DoxyCodeLine{}
\DoxyCodeLine{          return defaultCacheKeys;}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33002}{}\doxysubsubsection{$<$tt$>$parallel$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33002}
Type\+: {\ttfamily Boolean$\vert$\+Number} Default\+: {\ttfamily false}

Use multi-\/process parallel running to improve the build speed. Default number of concurrent runs\+: {\ttfamily os.\+cpus().length -\/ 1}.

\begin{quote}
ℹ️ Parallelization can speedup your build significantly and is therefore {\bfseries{highly recommended}}. \end{quote}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33003}{}\doxyparagraph{$<$tt$>$\+Boolean$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33003}
Enable/disable multi-\/process parallel running.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        parallel: true,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33004}{}\doxyparagraph{$<$tt$>$\+Number$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33004}
Enable multi-\/process parallel running and set number of concurrent runs.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        parallel: 4,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33005}{}\doxysubsubsection{$<$tt$>$source\+Map$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33005}
Type\+: {\ttfamily Boolean} Default\+: {\ttfamily false}

Use source maps to map error message locations to modules (this slows down the compilation). If you use your own {\ttfamily minify} function please read the {\ttfamily minify} section for handling source maps correctly.

\begin{quote}
⚠️ $\ast$$\ast${\ttfamily cheap-\/source-\/map} options don\textquotesingle{}t work with this plugin$\ast$$\ast$. \end{quote}
{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        sourceMap: true,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33006}{}\doxysubsubsection{$<$tt$>$minify$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33006}
Type\+: {\ttfamily Function} Default\+: {\ttfamily undefined}

Allows you to override default minify function. By default plugin uses \href{https://github.com/terser-js/terser}{\texttt{ terser}} package. Useful for using and testing unpublished versions or forks.

\begin{quote}
⚠️ {\bfseries{Always use {\ttfamily require} inside {\ttfamily minify} function when {\ttfamily parallel} option enabled}}. \end{quote}
{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        minify: (file, sourceMap) => \{}
\DoxyCodeLine{          const extractedComments = [];}
\DoxyCodeLine{}
\DoxyCodeLine{          // Custom logic for extract comments}
\DoxyCodeLine{}
\DoxyCodeLine{          const \{ error, map, code, warnings \} = require('uglify-\/module') // Or require('./path/to/uglify-\/module')}
\DoxyCodeLine{            .minify(file, \{}
\DoxyCodeLine{              /* Your options for minification */}
\DoxyCodeLine{            \});}
\DoxyCodeLine{}
\DoxyCodeLine{          return \{ error, map, code, warnings, extractedComments \};}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33007}{}\doxysubsubsection{$<$tt$>$terser\+Options$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33007}
Type\+: {\ttfamily Object} Default\+: \href{https://github.com/terser-js/terser\#minify-options}{\texttt{ default}}

Terser minify \href{https://github.com/terser-js/terser\#minify-options}{\texttt{ options}}.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        terserOptions: \{}
\DoxyCodeLine{          ecma: undefined,}
\DoxyCodeLine{          warnings: false,}
\DoxyCodeLine{          parse: \{\},}
\DoxyCodeLine{          compress: \{\},}
\DoxyCodeLine{          mangle: true, // Note `mangle.properties` is `false` by default.}
\DoxyCodeLine{          module: false,}
\DoxyCodeLine{          output: null,}
\DoxyCodeLine{          toplevel: false,}
\DoxyCodeLine{          nameCache: null,}
\DoxyCodeLine{          ie8: false,}
\DoxyCodeLine{          keep\_classnames: undefined,}
\DoxyCodeLine{          keep\_fnames: false,}
\DoxyCodeLine{          safari10: false,}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33008}{}\doxysubsubsection{$<$tt$>$extract\+Comments$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33008}
Type\+: {\ttfamily Boolean$\vert$\+String$\vert$\+Reg\+Exp$\vert$\+Function$<$(node, comment) -\/$>$ Boolean$\vert$\+Object$>$$\vert$\+Object} Default\+: {\ttfamily false}

Whether comments shall be extracted to a separate file, (see \href{https://github.com/webpack/webpack/commit/71933e979e51c533b432658d5e37917f9e71595a}{\texttt{ details}}). By default extract only comments using {\ttfamily /$^\wedge$\textbackslash{}$\ast$$\ast$!$\vert$@preserve$\vert$@license$\vert$@cc\+\_\+on/i} regexp condition and remove remaining comments. If the original file is named {\ttfamily foo.\+js}, then the comments will be stored to {\ttfamily foo.\+js.\+LICENSE}. The {\ttfamily terser\+Options.\+output.\+comments} option specifies whether the comment will be preserved, i.\+e. it is possible to preserve some comments (e.\+g. annotations) while extracting others or even preserving comments that have been extracted.\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33009}{}\doxyparagraph{$<$tt$>$\+Boolean$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33009}
Enable/disable extracting comments.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: true,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33010}{}\doxyparagraph{$<$tt$>$\+String$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33010}
Extract {\ttfamily all} or {\ttfamily some} (use {\ttfamily /$^\wedge$\textbackslash{}$\ast$$\ast$!$\vert$@preserve$\vert$@license$\vert$@cc\+\_\+on/i} Reg\+Exp) comments.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: 'all',}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33011}{}\doxyparagraph{$<$tt$>$\+Reg\+Exp$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33011}
All comments that match the given expression will be extracted to the separate file.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: /@extract/i,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33012}{}\doxyparagraph{$<$tt$>$\+Function$<$(node, comment) -\/$>$ Boolean$>$$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33012}
All comments that match the given expression will be extracted to the separate file.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: (astNode, comment) => \{}
\DoxyCodeLine{          if (/@extract/i.test(comment.value)) \{}
\DoxyCodeLine{            return true;}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{          return false;}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33013}{}\doxyparagraph{$<$tt$>$\+Object$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33013}
Allow to customize condition for extract comments, specify extracted file name and banner.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: \{}
\DoxyCodeLine{          condition: /\string^\(\backslash\)**!|@preserve|@license|@cc\_on/i,}
\DoxyCodeLine{          filename: (file) => \{}
\DoxyCodeLine{            return `\$\{file\}.LICENSE`;}
\DoxyCodeLine{          \},}
\DoxyCodeLine{          banner: (licenseFile) => \{}
\DoxyCodeLine{            return `License information can be found in \$\{licenseFile\}`;}
\DoxyCodeLine{          \},}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}


\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33014}%
\Hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33014}%
\doxysubparagraph*{{\ttfamily condition}}

Type\+: {\ttfamily Boolean$\vert$\+String$\vert$\+Reg\+Exp$\vert$\+Function$<$(node, comment) -\/$>$ Boolean$\vert$\+Object$>$}

Condition what comments you need extract.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: \{}
\DoxyCodeLine{          condition: 'some',}
\DoxyCodeLine{          filename: (file) => \{}
\DoxyCodeLine{            return `\$\{file\}.LICENSE`;}
\DoxyCodeLine{          \},}
\DoxyCodeLine{          banner: (licenseFile) => \{}
\DoxyCodeLine{            return `License information can be found in \$\{licenseFile\}`;}
\DoxyCodeLine{          \},}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}


\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33015}%
\Hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33015}%
\doxysubparagraph*{{\ttfamily filename}}

Type\+: {\ttfamily String$\vert$\+Function$<$(string) -\/$>$ String$>$} Default\+: {\ttfamily \$\{file\}.LICENSE}

The file where the extracted comments will be stored. Default is to append the suffix {\ttfamily .LICENSE} to the original filename.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: \{}
\DoxyCodeLine{          condition: /\string^\(\backslash\)**!|@preserve|@license|@cc\_on/i,}
\DoxyCodeLine{          filename: 'extracted-\/comments.js',}
\DoxyCodeLine{          banner: (licenseFile) => \{}
\DoxyCodeLine{            return `License information can be found in \$\{licenseFile\}`;}
\DoxyCodeLine{          \},}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}


\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33016}%
\Hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33016}%
\doxysubparagraph*{{\ttfamily banner}}

Type\+: {\ttfamily Boolean$\vert$\+String$\vert$\+Function$<$(string) -\/$>$ String$>$} Default\+: {\ttfamily /$\ast$! For license information please see \$\{comments\+File\} $\ast$/}

The banner text that points to the extracted file and will be added on top of the original file. Can be {\ttfamily false} (no banner), a {\ttfamily String}, or a {\ttfamily Function$<$(string) -\/$>$ String$>$} that will be called with the filename where extracted comments have been stored. Will be wrapped into comment.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        extractComments: \{}
\DoxyCodeLine{          condition: true,}
\DoxyCodeLine{          filename: (file) => \{}
\DoxyCodeLine{            return `\$\{file\}.LICENSE`;}
\DoxyCodeLine{          \},}
\DoxyCodeLine{          banner: (commentsFile) => \{}
\DoxyCodeLine{            return `My custom banner about license information \$\{commentsFile\}`;}
\DoxyCodeLine{          \},}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33017}{}\doxysubsubsection{$<$tt$>$warnings\+Filter$<$/tt$>$}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33017}
Type\+: {\ttfamily Function$<$(warning, source) -\/$>$ Boolean$>$} Default\+: {\ttfamily () =$>$ true}

Allow to filter \href{https://github.com/terser-js/terser}{\texttt{ terser}} warnings. Return {\ttfamily true} to keep the warning, {\ttfamily false} otherwise.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        warningsFilter: (warning, source) => \{}
\DoxyCodeLine{          if (/Dropping unreachable code/i.test(warning)) \{}
\DoxyCodeLine{            return true;}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{          if (/filename\(\backslash\).js/i.test(source)) \{}
\DoxyCodeLine{            return true;}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{          return false;}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33018}{}\doxysubsection{Examples}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33018}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33019}{}\doxysubsubsection{Cache And Parallel}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33019}
Enable cache and multi-\/process parallel running.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        cache: true,}
\DoxyCodeLine{        parallel: true,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33020}{}\doxysubsubsection{Preserve Comments}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33020}
Extract all legal comments (i.\+e. {\ttfamily /$^\wedge$\textbackslash{}$\ast$$\ast$!$\vert$@preserve$\vert$@license$\vert$@cc\+\_\+on/i}) and preserve {\ttfamily /@license/i} comments.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        terserOptions: \{}
\DoxyCodeLine{          output: \{}
\DoxyCodeLine{            comments: /@license/i,}
\DoxyCodeLine{          \},}
\DoxyCodeLine{        \},}
\DoxyCodeLine{        extractComments: true,}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33021}{}\doxysubsubsection{Remove Comments}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33021}
If you avoid building with comments, set {\bfseries{terser\+Options.\+output.\+comments}} to {\bfseries{false}} as in this config\+:

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        terserOptions: \{}
\DoxyCodeLine{          output: \{}
\DoxyCodeLine{            comments: false,}
\DoxyCodeLine{          \},}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33022}{}\doxysubsubsection{Custom Minify Function}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33022}
Override default minify function -\/ use {\ttfamily uglify-\/js} for minification.

{\bfseries{webpack.\+config.\+js}}


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = \{}
\DoxyCodeLine{  optimization: \{}
\DoxyCodeLine{    minimizer: [}
\DoxyCodeLine{      new TerserPlugin(\{}
\DoxyCodeLine{        // Uncomment lines below for cache invalidation correctly}
\DoxyCodeLine{        // cache: true,}
\DoxyCodeLine{        // cacheKeys: (defaultCacheKeys) => \{}
\DoxyCodeLine{        //   delete defaultCacheKeys.terser;}
\DoxyCodeLine{        //}
\DoxyCodeLine{        //   return Object.assign(}
\DoxyCodeLine{        //     \{\},}
\DoxyCodeLine{        //     defaultCacheKeys,}
\DoxyCodeLine{        //     \{ 'uglify-\/js': require('uglify-\/js/package.json').version \},}
\DoxyCodeLine{        //   );}
\DoxyCodeLine{        // \},}
\DoxyCodeLine{        minify: (file, sourceMap) => \{}
\DoxyCodeLine{          // https://github.com/mishoo/UglifyJS2\#minify-\/options}
\DoxyCodeLine{          const uglifyJsOptions = \{}
\DoxyCodeLine{            /* your `uglify-\/js` package options */}
\DoxyCodeLine{          \};}
\DoxyCodeLine{}
\DoxyCodeLine{          if (sourceMap) \{}
\DoxyCodeLine{            uglifyJsOptions.sourceMap = \{}
\DoxyCodeLine{              content: sourceMap,}
\DoxyCodeLine{            \};}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{          return require('uglify-\/js').minify(file, uglifyJsOptions);}
\DoxyCodeLine{        \},}
\DoxyCodeLine{      \}),}
\DoxyCodeLine{    ],}
\DoxyCodeLine{  \},}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33023}{}\doxysubsection{Contributing}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33023}
Please take a moment to read our contributing guidelines if you haven\textquotesingle{}t yet done so.

./.github/\+CONTRIBUTING.\+md \char`\"{}\+CONTRIBUTING\char`\"{}\hypertarget{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33024}{}\doxysubsection{License}\label{md_sfcode_node_modules_webpack_node_modules_terser_webpack_plugin_README_autotoc_md33024}
\href{./LICENSE}{\texttt{ MIT}} 