Skip to content

Commit

Permalink
disable prefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtatranta committed Mar 6, 2025
1 parent 31fa546 commit f1af5fb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 53 deletions.
8 changes: 8 additions & 0 deletions packages/suite-build/configs/analyze.webpack.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import webpack from 'webpack';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';

const config: webpack.Configuration = {
plugins: [new BundleAnalyzerPlugin()],
};

export default config;
41 changes: 16 additions & 25 deletions packages/suite-build/configs/base.webpack.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { sentryWebpackPlugin } from '@sentry/webpack-plugin';
import path from 'path';
import TerserPlugin from 'terser-webpack-plugin';
import webpack from 'webpack';
Expand All @@ -8,16 +7,8 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { WebpackSecurityCheckPlugin } from '@trezor/bundler-security';

import { suiteVersion } from '../../suite/package.json';
import {
assetPrefix,
isAnalyzing,
isCodesignBuild,
isDev,
project,
sentryAuthToken,
} from '../utils/env';
import { assetPrefix, isAnalyzing, isCodesignBuild, isDev, project } from '../utils/env';
import { getRevision } from '../utils/git';
import { getPathForProject } from '../utils/path';
const gitRevision = getRevision();

/**
Expand Down Expand Up @@ -187,21 +178,21 @@ const config: webpack.Configuration = {
}),
]
: []),
...(!isDev && sentryAuthToken
? [
sentryWebpackPlugin({
telemetry: false,
org: 'satoshilabs',
project: 'trezor-suite',
authToken: sentryAuthToken,
release: { name: sentryRelease, cleanArtifacts: true },
sourcemaps: {
assets: path.join(getPathForProject(project), 'build', '**'),
ignore: ['static/connect'], // connect does not contain source maps for now
},
}),
]
: []),
// ...(!isDev && sentryAuthToken
// ? [
// sentryWebpackPlugin({
// telemetry: false,
// org: 'satoshilabs',
// project: 'trezor-suite',
// authToken: sentryAuthToken,
// release: { name: sentryRelease, cleanArtifacts: true },
// sourcemaps: {
// assets: path.join(getPathForProject(project), 'build', '**'),
// ignore: ['static/connect'], // connect does not contain source maps for now
// },
// }),
// ]
// : []),
],
};

Expand Down
30 changes: 8 additions & 22 deletions packages/suite-build/configs/web.webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FLAGS, routes } from '@suite-common/suite-config';
import { assetPrefix, isDev } from '../utils/env';
import { getPathForProject } from '../utils/path';

const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin');
// const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin');

const baseDir = getPathForProject('web');
const config: webpack.Configuration = {
Expand All @@ -21,20 +21,6 @@ const config: webpack.Configuration = {
resolve: {
fallback: { vm: require.resolve('vm-browserify') },
},
optimization: {
splitChunks: {
minSize: 100_000,
maxInitialRequests: 2,
cacheGroups: {
main: {
name: 'main',
test: /main/, // Prioritize `main.js`
chunks: 'all',
priority: 100, // High priority
},
},
},
},
plugins: [
new CopyWebpackPlugin({
patterns: ['browser-detection', 'fonts', 'images', 'oauth', 'videos', 'guide/assets']
Expand Down Expand Up @@ -90,13 +76,13 @@ const config: webpack.Configuration = {
/@trezor\/connect$/,
'@trezor/connect-web/src/module',
),
new PreloadWebpackPlugin({
rel: 'prefetch',
include: 'asyncChunks',
// NOTE: only prefetch js files
fileWhitelist: [/\.js$/],
fileBlacklist: [/_svg\.js$/, /date-fns/, /json\.js/, /suite-data/],
}),
// new PreloadWebpackPlugin({
// rel: 'prefetch',
// include: 'asyncChunks',
// // NOTE: only prefetch js files
// fileWhitelist: [/\.js$/],
// fileBlacklist: [/_svg\.js$/, /date-fns/, /json\.js/, /suite-data/],
// }),
...(!isDev ? [new CssMinimizerPlugin()] : []),
],
};
Expand Down
11 changes: 5 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12363,7 +12363,7 @@ __metadata:
terser-webpack-plugin: "npm:^5.3.11"
vm-browserify: "npm:^1.1.2"
webpack: "npm:^5.97.1"
webpack-bundle-analyzer: "npm:^4.10.1"
webpack-bundle-analyzer: "npm:^4.10.2"
webpack-merge: "npm:^6.0.1"
webpack-nano: "npm:^1.1.1"
webpack-plugin-serve: "npm:^1.6.0"
Expand Down Expand Up @@ -43111,9 +43111,9 @@ __metadata:
languageName: node
linkType: hard

"webpack-bundle-analyzer@npm:^4.10.1":
version: 4.10.1
resolution: "webpack-bundle-analyzer@npm:4.10.1"
"webpack-bundle-analyzer@npm:^4.10.2":
version: 4.10.2
resolution: "webpack-bundle-analyzer@npm:4.10.2"
dependencies:
"@discoveryjs/json-ext": "npm:0.5.7"
acorn: "npm:^8.0.4"
Expand All @@ -43123,14 +43123,13 @@ __metadata:
escape-string-regexp: "npm:^4.0.0"
gzip-size: "npm:^6.0.0"
html-escaper: "npm:^2.0.2"
is-plain-object: "npm:^5.0.0"
opener: "npm:^1.5.2"
picocolors: "npm:^1.0.0"
sirv: "npm:^2.0.3"
ws: "npm:^7.3.1"
bin:
webpack-bundle-analyzer: lib/bin/analyzer.js
checksum: 10/bc7bc2c014ba36dfb3f28ef75e3bb4be17ebff092ae713a30392a1d578a73b5d83ed0940b9d12eca6b06e514218d8a1e7cb0610f0b4d74b53425be3f0cc3aea8
checksum: 10/cb7ff9d01dc04ef23634f439ab9fe739e022cce5595cb340e01d106ed474605ce4ef50b11b47e444507d341b16650dcb3610e88944020ca6c1c38e88072d43ba
languageName: node
linkType: hard

Expand Down

0 comments on commit f1af5fb

Please sign in to comment.