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

Unknown error when setting up NextJS config #171

Open
Janealter opened this issue Nov 10, 2024 · 3 comments
Open

Unknown error when setting up NextJS config #171

Janealter opened this issue Nov 10, 2024 · 3 comments

Comments

@Janealter
Copy link

Unknown error when setting up NextJS config:

Injecting property=output and value=export in:
import bundleAnalyzer from '@next/bundle-analyzer';
const withBundleAnalyzer = bundleAnalyzer({
  enabled: process.env.ANALYZE === 'true',
});
export default withBundleAnalyzer({
  reactStrictMode: false,
  eslint: {
    ignoreDuringBuilds: true,
  },
  experimental: {
    optimizePackageImports: ['@mantine/core', '@mantine/hooks'],
  },
});
Error: TypeError: error must be an instance of Error
@Janealter
Copy link
Author

As I tested, this is because my config contains

import bundleAnalyzer from '@next/bundle-analyzer';

const withBundleAnalyzer = bundleAnalyzer({
  enabled: process.env.ANALYZE === 'true',
});

@Janealter
Copy link
Author

I think this PR solves the issue - #161

@rajatsandeepsen
Copy link

I saw a similar issue in Nextjs Repo

Then made a complex work around in workspace yml to solve this issue

Like

  1. reset the next.config file to default with zero configurations
  2. then run the Setup Pages (it will add some important info like basePath to config)
  3. then edit the next.config file to merge your configuration and configuration from setup pages

Example

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

No branches or pull requests

2 participants