4lejandrito / next-plausible

Simple integration for https://nextjs.org and https://plausible.io analytics
https://next-plausible.vercel.app
MIT License
603 stars 33 forks source link

The root value has an unexpected property #65

Closed alvarlagerlof closed 2 years ago

alvarlagerlof commented 2 years ago

- The root value has an unexpected property, 0, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, future, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOpt

I get this when I build.

4lejandrito commented 2 years ago

Hi @alvarlagerlof, can you share how you're using PlausibleProvider and next.config.js if you use the proxy?

alvarlagerlof commented 2 years ago

I do this:

const { withPlausibleProxy } = require("next-plausible");

const nextConfig = withPlausibleProxy({
  reactStrictMode: true,
  swcMinify: true,
  experimental: { images: { allowFutureImage: true } },
});

module.exports = nextConfig;
4lejandrito commented 2 years ago

I do this:

const { withPlausibleProxy } = require("next-plausible");

const nextConfig = withPlausibleProxy({
  reactStrictMode: true,
  swcMinify: true,
  experimental: { images: { allowFutureImage: true } },
});

module.exports = nextConfig;

Hey @alvarlagerlof, you're passing the next config as parameter to withPlausibleProxy. That function receives its own configuration, and returns a function in which you can pass the next configuration. So you should call it like this:

const { withPlausibleProxy } = require("next-plausible");

const nextConfig = withPlausibleProxy()({
  reactStrictMode: true,
  swcMinify: true,
  experimental: { images: { allowFutureImage: true } },
});

module.exports = nextConfig;

Can you notice the difference? Please let me know if it works.

Thanks!

alvarlagerlof commented 2 years ago

Ah, thank you. I will try this.

4lejandrito commented 2 years ago

I'll close this for now. Let me know if you still have issues.