diff --git a/bun.lockb b/bun.lockb
index 40e32e38..173f706e 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/example/vanilla-js/index.html b/example/vanilla-js/index.html
index 9c5a4fb9..67881177 100644
--- a/example/vanilla-js/index.html
+++ b/example/vanilla-js/index.html
@@ -5,9 +5,8 @@
Example Vanilla JS
-
-
+ <%- injectScript %>
Welcome to example Vanilla JS
diff --git a/example/vanilla-js/package.json b/example/vanilla-js/package.json
index af220392..231744ab 100644
--- a/example/vanilla-js/package.json
+++ b/example/vanilla-js/package.json
@@ -16,6 +16,7 @@
"devDependencies": {
"@frak-labs/core-sdk": "workspace:*",
"typescript": "^5",
- "vite": "^5.4.11"
+ "vite": "^5.4.11",
+ "vite-plugin-html": "^3.2.2"
}
}
diff --git a/example/vanilla-js/src/main.ts b/example/vanilla-js/src/main.ts
index 825405f1..55811b89 100644
--- a/example/vanilla-js/src/main.ts
+++ b/example/vanilla-js/src/main.ts
@@ -1,6 +1,11 @@
+const walletUrl =
+ process.env.NODE_ENV === "production"
+ ? "https://wallet-dev.frak.id"
+ : "https://localhost:3000";
+
window.FrakSetup = {
config: {
- walletUrl: "https://localhost:3000",
+ walletUrl,
metadata: {
name: "Your App Name",
},
diff --git a/example/vanilla-js/vite.config.ts b/example/vanilla-js/vite.config.ts
index 3fed743f..9a5edd8d 100644
--- a/example/vanilla-js/vite.config.ts
+++ b/example/vanilla-js/vite.config.ts
@@ -1,8 +1,13 @@
import { resolve } from "node:path";
import { defineConfig } from "vite";
+import { createHtmlPlugin } from "vite-plugin-html";
const projectRootDir = resolve(__dirname);
const bundleDir = resolve(projectRootDir, "../../sdk/components/cdn");
+const scriptSrc =
+ process.env.NODE_ENV === "production"
+ ? "https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/dist/bundle/components.js"
+ : `${bundleDir}/components.js`;
export default defineConfig({
server: {
@@ -10,16 +15,12 @@ export default defineConfig({
},
publicDir: "public",
plugins: [
- {
- name: "html-transform",
- transformIndexHtml(html) {
- // Replace @/ with the actual path in HTML files
- return html.replace(
- /`,
+ },
},
- },
+ }),
],
});