Files
explore/next.config.js
T
tom goriunovandGitHub 811ba0a437 Move generated assets into separate folder inside the public folder (#1930)
* add build-time ENV to explicitly enable Open Telemetry

* generate svg-sprite before next build

* move envs.js to assets folder

* move favicon bundle to assets folder

* move external configs to configs folder

* fix envs validator
2024-05-20 13:17:33 +02:00

62 lines
1.7 KiB
JavaScript

const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.BUNDLE_ANALYZER === 'true',
});
const withRoutes = require('nextjs-routes/config')({
outDir: 'nextjs',
});
const headers = require('./nextjs/headers');
const redirects = require('./nextjs/redirects');
const rewrites = require('./nextjs/rewrites');
/** @type {import('next').NextConfig} */
const moduleExports = {
transpilePackages: [
'react-syntax-highlighter',
'swagger-client',
'swagger-ui-react',
],
reactStrictMode: true,
webpack(config, { webpack }) {
config.plugins.push(
new webpack.DefinePlugin({
__SENTRY_DEBUG__: false,
__SENTRY_TRACING__: false,
}),
);
config.module.rules.push(
{
test: /\.svg$/,
use: [ '@svgr/webpack' ],
},
);
config.resolve.fallback = { fs: false, net: false, tls: false };
config.externals.push('pino-pretty', 'lokijs', 'encoding');
return config;
},
// NOTE: all config functions should be static and not depend on any environment variables
// since all variables will be passed to the app only at runtime and there is now way to change Next.js config at this time
// if you are stuck and strongly believe what you need some sort of flexibility here please fill free to join the discussion
// https://github.com/blockscout/frontend/discussions/167
rewrites,
redirects,
headers,
output: 'standalone',
productionBrowserSourceMaps: true,
experimental: {
instrumentationHook: process.env.NEXT_OPEN_TELEMETRY_ENABLED === 'true',
turbo: {
rules: {
'*.svg': {
loaders: [ '@svgr/webpack' ],
as: '*.js',
},
},
},
},
};
module.exports = withBundleAnalyzer(withRoutes(moduleExports));