Files
Nathan Rajlich b8bc682d3e [gatsby-plugin-vercel-analytics] Remove "babel" compilation (#10546)
The "babel" build for this package essentially does nothing. The output is still using ESM and no transformation is done. Let's just remove the "build" script entirely.
2023-09-19 20:45:26 +00:00

18 lines
373 B
JavaScript

import { webVitals } from "./web-vitals";
export const onClientEntry = (_, pluginOptions = {}) => {
let options = {
debug: false,
...pluginOptions,
analyticsId: process.env.GATSBY_VERCEL_ANALYTICS_ID,
};
if (!options.analyticsId) {
return null;
}
if (options.debug || process.env.NODE_ENV === "production") {
webVitals({ options });
}
};