const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { InjectManifest, GenerateSW } = require('workbox-webpack-plugin'); const withPWA = require('next-pwa')({ dest: 'public', register: true, // ? publicExcludes: ["!_error*.js"], //? skipWaiting: true, // disable: process.env.NODE_ENV === 'development', }) module.exports = withPWA({ typescript: { // !! WARN !! // Dangerously allow production builds to successfully complete even if // your project has type errors. // !! WARN !! ignoreBuildErrors: true, }, compress: false, pageExtensions: ['ts', 'tsx', 'md', 'mdx'], // Replace `jsx?` with `tsx?` env: { env: process.env.APP_ENV, server: process.env.NEXT_PUBLIC_PUBLIC_URL }, // pwa: { // dest: 'public', // register: true, // publicExcludes: ["!_error*.js"], // disable: process.env.NODE_ENV === 'development', // // sw: './worker/index.js', // Custom service worker file name // }, // plugins: [ // // new InjectManifest({ // // // These are some common options, and not all are required. // // // Consult the docs for more info. // // //exclude: [/.../, '...'], // // maximumFileSizeToCacheInBytes: 1 * 1024 * 1024, // // swSrc: './worker.js', // // }), // // new GenerateSW({ // // //disable all files // // maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // // // swSrc: './worker.js', // // }), // ], webpack: (config, { isServer, buildId, dev }) => { // Configure optimization and source maps config.optimization.minimize = !dev; //config.productionBrowserSourceMaps = true; // Enable source maps based on non-production environments if (!dev) { config.devtool = 'source-map'; } // Add custom fallbacks config.resolve.fallback = { ...config.resolve.fallback, fs: false }; // InjectManifest configuration if (!isServer) { // config.plugins.push(new InjectManifest({ // // swSrc: './worker.js', // Path to source service worker file // // swDest: '/worker.js', // Destination filename in the build output // maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // Adjust as needed // exclude: [/\.map$/, /_error.js$/, /favicon.ico$/] // Customize exclusion patterns // }) // ); } // Bundle Analyzer Configuration if (process.env.ANALYZE && !isServer) { //const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); config.plugins.push( new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: true, generateStatsFile: true, }) ); } return config; }, i18n: { // next-intl // https://next-intl-docs.vercel.app/docs/usage/messages // using https://next-intl-docs.vercel.app/docs/getting-started/pages-router locales: ['bg', 'en', 'ru'], defaultLocale: 'bg', localeDetection: false, }, })