Files
trezor-suite/packages/connect-explorer/next.config.mjs
Martin Varmuza 09187966be refactor(connect): remove connectSrc setting
Remove connectSrc configuration option from connect-web and connect-webextension:
- Remove connectSrc from ConnectSettingsPublic interface
- Move connectSrc to ConnectSettingsMobile only (still needed for mobile deeplink)
- Remove connectSrc parsing and validation in parseConnectSettings
- Remove global __TREZOR_CONNECT_SRC window variable handling
- Update connect-explorer to remove connectSrc initialization logic
- Simplify mobile-expo example (always use trezorsuite://connect)
- Remove connectSrc from middleware and action handlers

The new architecture uses Suite Web popup directly without configurable connect source.
2026-02-10 17:28:48 +01:00

91 lines
3.0 KiB
JavaScript

import rehypeSectionize from '@hbsnow/rehype-sectionize';
import { execSync } from 'child_process';
import nextra from 'nextra';
import path from 'path';
import remarkGemoji from 'remark-gemoji';
const withNextra = nextra({
theme: '@trezor/connect-explorer-theme',
themeConfig: './theme.config.tsx',
mdxOptions: {
remarkPlugins: [remarkGemoji],
rehypePlugins: [[rehypeSectionize]],
},
defaultShowCopyCode: true,
});
const commitHash = execSync('git rev-parse HEAD').toString().trim();
export default withNextra({
basePath: process.env.CONNECT_EXPLORER_BASE_PATH,
assetPrefix: process.env.CONNECT_EXPLORER_ASSET_PREFIX,
trailingSlash: true,
output: 'export',
images: {
unoptimized: true,
},
transpilePackages: ['codemirror-json-schema', 'json-schema-library', '@trezor/components'],
compiler: {
styledComponents: true,
},
webpack: (config, { webpack }) => {
// Image loader
config.module.rules.push({
test: /\.(svg)$/,
type: 'asset/resource',
});
config.plugins.push(
new webpack.DefinePlugin({
'process.env.COMMIT_HASH': JSON.stringify(commitHash),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.BUILD_TARGET': JSON.stringify(process.env.BUILD_TARGET),
'process.env.CONNECT_EXPLORER_FULL_URL': JSON.stringify(
process.env.CONNECT_EXPLORER_FULL_URL?.replace(
'staging-connect.trezor.io',
'connect.trezor.io',
),
),
}),
);
if (process.env.BUILD_TARGET === 'webextension') {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/@trezor\/connect-web$/,
'@trezor/connect-webextension/src/proxy',
),
// Replace the full icons bundle with a minimal version containing only used icons
// This prevents bundling 2,677 unused SVG files (11MB) into build
new webpack.NormalModuleReplacementPlugin(
/@suite-common\/icons\/src\/icons$/,
path.resolve('./src/icons/minimalIcons.ts'),
),
);
}
config.resolve.alias = {
...config.resolve.alias,
'styled-components': path.resolve('../../node_modules', 'styled-components'),
'next-themes': path.resolve('../../node_modules', 'next-themes'),
};
},
typescript: {
// Problems with transpiling
ignoreBuildErrors: true,
},
rewrites() {
if (process.env.NODE_ENV !== 'development') {
return {};
}
return {
// Proxy to local server with popup
fallback: [
{
source: '/:path*',
destination: `http://localhost:8089/:path*`,
},
],
};
},
});