Skip to content

Commit

Permalink
Revert to using worker-loader and replace deprecated css optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
orhoj committed Dec 16, 2021
1 parent 8490452 commit 5c8fe29
Show file tree
Hide file tree
Showing 5 changed files with 444 additions and 490 deletions.
6 changes: 4 additions & 2 deletions app/utils/rustInterface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import PromiseWorker from 'promise-worker';
import { AccountEncryptedAmount } from '@concordium/node-sdk/';
import { BakerKeyVariants } from './rust.worker';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error : has no default export.
import RustWorker, { BakerKeyVariants } from './rust.worker';
import {
PublicInformationForIp,
ConfirmedIdentity,
Expand All @@ -24,7 +26,7 @@ import { getAccountPath } from '~/features/ledger/Path';
import { stringify, parse } from './JSONHelper';
import CredentialInfoLedgerDetails from '~/components/ledger/CredentialInfoLedgerDetails';

const rawWorker = new Worker(new URL('./rust.worker.ts', import.meta.url));
const rawWorker = new RustWorker();
const worker = new PromiseWorker(rawWorker);

const identityCreatedUsingDeprecatedKeyGen = (version: IdentityVersion) =>
Expand Down
11 changes: 11 additions & 0 deletions configs/partials/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ module.exports = {

module: {
rules: [
{
test: /\.worker\.ts?$/,
use: [
{
loader: 'worker-loader',
options: {
publicPath: './',
},
},
],
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
Expand Down
31 changes: 13 additions & 18 deletions configs/webpack.config.renderer.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

const webpack = require('webpack');
const path = require('path');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
const { merge } = require('webpack-merge');
Expand Down Expand Up @@ -39,26 +39,21 @@ module.exports = merge(baseConfig, assetsConfig, stylesConfig(true), {
path: fromRoot('./app/dist'),
publicPath: './dist/',
filename: 'renderer.prod.js',
library: {
type: 'umd',
},
},

optimization: {
minimizer: process.env.E2E_BUILD
? []
: [
new TerserPlugin({
parallel: true,
sourceMap: true,
cache: true,
}),
new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
map: {
inline: false,
annotation: true,
},
},
}),
],
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
sourceMap: true,
cache: true,
}),
new CssMinimizerPlugin(),
],
},

experiments: {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"core-js": "^3.6.5",
"cross-env": "^7.0.2",
"css-loader": "^6.5.1",
"css-minimizer-webpack-plugin": "^3.2.0",
"detect-port": "^1.3.0",
"electron-builder": "^22.11.7",
"electron-devtools-installer": "3.2.0",
Expand Down Expand Up @@ -218,7 +219,6 @@
"mini-css-extract-plugin": "^2.4.5",
"node-sass": "^4.14.1",
"opencollective-postinstall": "^2.0.3",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"prettier": "^2.0.5",
"react-test-renderer": "^16.12.0",
"redux-logger": "^3.0.6",
Expand All @@ -245,6 +245,7 @@
"webpack-cli": "^4.9.1",
"webpack-dev-server": "4.6.0",
"webpack-merge": "^5.0.9",
"worker-loader": "^3.0.8",
"yargs": "^17.1.1"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 5c8fe29

Please sign in to comment.