50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
const withBundleAnalyzer = require('@next/bundle-analyzer')({
 | 
						|
  enabled: process.env.ANALYZE === 'true',
 | 
						|
})
 | 
						|
 | 
						|
module.exports = withBundleAnalyzer({
 | 
						|
  reactStrictMode: true,
 | 
						|
  pageExtensions: ['js', 'jsx', 'md', 'mdx'],
 | 
						|
  eslint: {
 | 
						|
    dirs: ['pages', 'components', 'lib', 'layouts', 'scripts'],
 | 
						|
  },
 | 
						|
  images: {
 | 
						|
    unoptimized: true
 | 
						|
  },
 | 
						|
  basePath: '',
 | 
						|
  assetPrefix: '',
 | 
						|
  experimental: { esmExternals: true },
 | 
						|
  webpack: (config, { dev, isServer }) => {
 | 
						|
    config.module.rules.push({
 | 
						|
      test: /\.(png|jpe?g|gif|mp4)$/i,
 | 
						|
      use: [
 | 
						|
        {
 | 
						|
          loader: 'file-loader',
 | 
						|
          options: {
 | 
						|
            publicPath: '/_next',
 | 
						|
            name: 'static/media/[name].[hash].[ext]',
 | 
						|
          },
 | 
						|
        },
 | 
						|
      ],
 | 
						|
    })
 | 
						|
 | 
						|
    config.module.rules.push({
 | 
						|
      test: /\.svg$/,
 | 
						|
      use: ['@svgr/webpack'],
 | 
						|
    })
 | 
						|
 | 
						|
    if (!dev && !isServer) {
 | 
						|
      // Replace React with Preact only in client production build
 | 
						|
      Object.assign(config.resolve.alias, {
 | 
						|
        react: 'preact/compat',
 | 
						|
        'react-dom/test-utils': 'preact/test-utils',
 | 
						|
        'react-dom': 'preact/compat',
 | 
						|
      })
 | 
						|
    }
 | 
						|
 | 
						|
    return config
 | 
						|
  },
 | 
						|
  // output: "standalone"
 | 
						|
  output: "export"
 | 
						|
})
 |