const withMDX = require('@next/mdx')({ extension: /\.mdx?$/, options: { // Disable MDX createElement hack // because we don't need rendering custom elements renderer: ` import React from 'react'; const mdx = (name, props, ...children) => { return React.createElement(name, props, ...children); } `, }, }); /** @type {import('next').NextConfig} */ module.exports = withMDX({ basePath: process.env.BASE_PATH || '', pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'], reactStrictMode: true, productionBrowserSourceMaps: true, experimental: { esmExternals: 'loose', }, webpack(config, options) { config.module.rules.push({ resourceQuery: /url/, type: "asset/resource", generator: { filename: "static/chunks/[name].[hash][ext]", }, }); // https://github.com/vercel/next.js/issues/25484 config.optimization.splitChunks = { chunks: "async", minSize: 20000, minRemainingSize: 0, minChunks: 1, maxAsyncRequests: 30, maxInitialRequests: 30, enforceSizeThreshold: 50000, cacheGroups: { defaultVendors: false, default: false, framework: { chunks: "all", name: "framework", test: /(?