Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Next. An error occurred in next/font with @fullhuman/postcss-purgecss #1298

Open
1 task done
msfreeman982 opened this issue Nov 30, 2024 · 1 comment
Open
1 task done
Labels

Comments

@msfreeman982
Copy link

msfreeman982 commented Nov 30, 2024

Describe the bug

Creating an optimized production build ...
Failed to compile.

src\app\layout.js
An error occurred in next/font.

TypeError: require(...) is not a function

Configuration:

 '@fullhuman/postcss-purgecss': {
        content: [
            './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
            './src/components/**/*.{js,ts,jsx,tsx,mdx}',
            './src/lib/**/*.{js,ts,jsx,tsx,mdx}',
            './src/app/**/*.{js,ts,jsx,tsx,mdx}'
        ],
        defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [],
    }

Layout:

import { Inter } from 'next/font/google';

const inter = Inter({ subsets: ['latin'], display: 'swap' });

export default function RootLayout({ children }) {
    return (
        <html lang="en">
            <body className={inter.className}>{children}</body>
        </html>
    );
}

It doesn't work with "@fullhuman/postcss-purgecss": "7.0.1-alpha.0" OR "@fullhuman/postcss-purgecss": "7.0.2"
but work with "@fullhuman/postcss-purgecss": "6.0.0"

To Reproduce

  1. Install Next 14.2.5
  2. Install "@fullhuman/postcss-purgecss": "7.0.1-alpha.0" OR "@fullhuman/postcss-purgecss": "7.0.2"
  3. Use 'next/font/google' in layout
  4. Run build

Expected Behavior

Build should be successful

Environment

OS: Windows
Next: 14.2.5

"@fullhuman/postcss-purgecss": "7.0.1-alpha.0" OR "@fullhuman/postcss-purgecss": "7.0.2"

Add any other context about the problem here

context

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Daniel3711997
Copy link

See #1295 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants