1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/build/webpack/plugins/terser-webpack-plugin/src/worker.js
Tim Neutkens 155423f26b
Bring in terser-webpack-plugin (backport #6231 to master) (#6232)
* Bring in terser-webpack-plugin (backport #6231 to master)

* Use correct path for ignore

* Comment out schema
2019-02-10 05:32:32 +01:00

22 lines
577 B
JavaScript

import minify from './minify';
module.exports = (options, callback) => {
try {
// 'use strict' => this === undefined (Clean Scope)
// Safer for possible security issues, albeit not critical at all here
// eslint-disable-next-line no-new-func, no-param-reassign
options = new Function(
'exports',
'require',
'module',
'__filename',
'__dirname',
`'use strict'\nreturn ${options}`
)(exports, require, module, __filename, __dirname);
callback(null, minify(options));
} catch (errors) {
callback(errors);
}
};