From a4cadaef0d9ef351c638c033d379cf6d9bea9955 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Sat, 4 Feb 2023 13:44:19 +0100 Subject: [PATCH] compress --- .../src/app/plugins/remixd-handle.tsx | 1 + apps/remix-ide/webpack.config.js | 19 ++++++++++++------- package.json | 1 + yarn.lock | 8 ++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/remixd-handle.tsx b/apps/remix-ide/src/app/plugins/remixd-handle.tsx index 62329cf327..7f5b1e8f5e 100644 --- a/apps/remix-ide/src/app/plugins/remixd-handle.tsx +++ b/apps/remix-ide/src/app/plugins/remixd-handle.tsx @@ -3,6 +3,7 @@ import React, { useRef, useState, useEffect } from 'react' // eslint-disable-lin import isElectron from 'is-electron' import { WebsocketPlugin } from '@remixproject/engine-web' import * as packageJson from '../../../../../package.json' +// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries import { version as remixdVersion } from '../../../../../libs/remixd/package.json' import { PluginManager } from '@remixproject/engine' import { AppModal, AlertModal } from '@remix-ui/app' diff --git a/apps/remix-ide/webpack.config.js b/apps/remix-ide/webpack.config.js index e5eb0afde2..28760a3013 100644 --- a/apps/remix-ide/webpack.config.js +++ b/apps/remix-ide/webpack.config.js @@ -5,6 +5,7 @@ const CopyPlugin = require("copy-webpack-plugin"); const version = require('../../package.json').version const fs = require('fs') const TerserPlugin = require("terser-webpack-plugin"); +const CompressionPlugin = require("compression-webpack-plugin"); const versionData = { version: version, @@ -74,18 +75,22 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { new TerserPlugin({ parallel: true, terserOptions: { - ecma: 6, - compress: { - drop_console: true, - }, - output: { - comments: false, - }, + ecma: 2015, + compress: true, }, extractComments: false, }), ]; + // add compression plugin + config.plugins.push( + new CompressionPlugin({ + test: /\.js(\?.*)?$/i, + filename: '[path][base].gz', + }) + ) + + console.log(config) diff --git a/package.json b/package.json index f2e6dcedbe..b6aaf9e48b 100644 --- a/package.json +++ b/package.json @@ -278,6 +278,7 @@ "colors": "^1.4.0", "colors-browserify": "^0.1.1", "component-type": "^1.2.1", + "compression-webpack-plugin": "^10.0.0", "constants-browserify": "^1.0.0", "copy-to-clipboard": "^3.3.1", "copy-webpack-plugin": "^11.0.0", diff --git a/yarn.lock b/yarn.lock index e8dcfee9b5..d1849714fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9803,6 +9803,14 @@ compressible@~2.0.16: dependencies: mime-db ">= 1.43.0 < 2" +compression-webpack-plugin@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/compression-webpack-plugin/-/compression-webpack-plugin-10.0.0.tgz#3496af1b0dc792e13efc474498838dbff915c823" + integrity sha512-wLXLIBwpul/ALcm7Aj+69X0pYT3BYt6DdPn3qrgBIh9YejV9Bju9ShhlAsjujLyWMo6SAweFIWaUoFmXZNuNrg== + dependencies: + schema-utils "^4.0.0" + serialize-javascript "^6.0.0" + compression@^1.7.4: version "1.7.4" resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f"