Skip to content

Commit

Permalink
update plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tsotimus committed Jan 14, 2024
1 parent 56686a6 commit 41569d6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/vite-plugin-posthog/src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { HtmlTagDescriptor, Plugin } from "vite";
import { VitePostHogProps } from "../types.js";
import { VitePostHogOptions } from "../types.js";
import { constructScript } from "./construct.js";

export function VitePostHog(options: VitePostHogProps): Plugin {
/**
*
* @param options
* @returns
*/
export function VitePostHog(options: VitePostHogOptions): Plugin {
return {
name: "vite-plugin-posthog",
enforce: "post",
Expand All @@ -13,7 +18,12 @@ export function VitePostHog(options: VitePostHogProps): Plugin {
attrs: {
type: "text/javascript",
},
children: constructScript(options.apiKey, options.hostUrl),
children: constructScript(
options.apiKey,
options.hostUrl,
options.isDevModeOn ?? false,
options.config ?? {}
),
};
return [injectedTag];
},
Expand Down

0 comments on commit 41569d6

Please sign in to comment.