cli: switch to using esbuild for minifcation
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -61,7 +61,8 @@
|
||||
"commander": "^6.1.0",
|
||||
"css-loader": "^6.5.1",
|
||||
"diff": "^5.0.0",
|
||||
"esbuild": "^0.14.1",
|
||||
"esbuild": "^0.14.10",
|
||||
"esbuild-loader": "^2.18.0",
|
||||
"eslint": "^7.30.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-formatter-friendly": "^7.0.0",
|
||||
|
||||
@@ -14,10 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { WebpackOptionsNormalized, WebpackPluginInstance } from 'webpack';
|
||||
import TerserPlugin from 'terser-webpack-plugin';
|
||||
import { WebpackOptionsNormalized } from 'webpack';
|
||||
import { BundlingOptions } from './types';
|
||||
import { isParallelDefault } from '../parallel';
|
||||
import { ESBuildMinifyPlugin } from 'esbuild-loader';
|
||||
|
||||
export const optimization = (
|
||||
options: BundlingOptions,
|
||||
@@ -26,16 +25,11 @@ export const optimization = (
|
||||
|
||||
return {
|
||||
minimize: !isDev,
|
||||
// Only configure when parallel is explicitly overridden from the default
|
||||
...(!isParallelDefault(options.parallel)
|
||||
? {
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: options.parallel,
|
||||
}) as unknown as WebpackPluginInstance,
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
minimizer: [
|
||||
new ESBuildMinifyPlugin({
|
||||
target: 'es2019',
|
||||
}),
|
||||
],
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
automaticNameDelimiter: '-',
|
||||
|
||||
Reference in New Issue
Block a user