跳转到主要内容

next.config.js 配置多 plugins

  1. 安装库 next-compose-plugins
yarn add next-compose-plugins
  1. 配置 next.config.js
/** @type {import('next').NextConfig} */
const withPlugins = require('next-compose-plugins');
const withImages = require('next-images')


const nextConfig = {
    reactStrictMode: true,
    images: {
        domains: ['avatars.githubusercontent.com'],
        disableStaticImages: true
    },
    // Append the default value with md extensions
    pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx']
}

const withMDX = require('@next/mdx')({
    extension: /\.mdx?$/,
    options: {
        remarkPlugins: [],
        rehypePlugins: [],
        providerImportSource: "@mdx-js/react"
    }
})

module.exports = withPlugins([
    [withImages, {
        fileExtensions: ["jpg", "jpeg", "png", "gif"]
    }],
    [withMDX]
], nextConfig);