Skip to content

Commit

Permalink
Fix Custom Components and Add SDK to build
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrozadotdev committed Nov 8, 2023
1 parent 456c3da commit 792371e
Show file tree
Hide file tree
Showing 15 changed files with 10,419 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const pt = {
"Jul",
"Ago",
"Set",
"out",
"Out",
"Nov",
"Dez",
],
Expand Down
1 change: 1 addition & 0 deletions client/packages/openblocks-sdk/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
margin-right: 10px;
}
</style>
<script type="module" crossorigin src="/js/proxy.js"></script>
</head>
<body>
<h1 class="demo-title">Use in vanilla app</h1>
Expand Down
2 changes: 1 addition & 1 deletion client/packages/openblocks-sdk/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AppViewInstance, bootstrapAppAt, OpenblocksAppView } from "./src/index"

const url = new URL(location.href);
const appId = url.searchParams.get("appId");
const baseUrl = url.searchParams.get("baseUrl") || "http://localhost:8000";
const baseUrl = url.searchParams.get("baseUrl") || window.location.origin;

function ReactDemoApp() {
const ref = useRef<AppViewInstance | null>(null);
Expand Down
12 changes: 7 additions & 5 deletions client/packages/openblocks-sdk/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export const viteConfig: UserConfig = {
formats: ["es"],
entry: "./src/index.ts",
name: "Openblocks",
fileName: "openblocks-sdk",
fileName: "main",
},
rollupOptions: {
external: ["react", "react-dom"],
external: ["react", "react-dom", "/js/proxy.js"],
output: {
chunkFileNames: "[hash].js",
},
Expand All @@ -53,10 +53,12 @@ export const viteConfig: UserConfig = {
},
server: {
proxy: {
"/api": {
target: "http://localhost:3000",
changeOrigin: false,
"/js/proxy.js": "http://127.0.0.1:8090",
"/api/realtime": {
target: "ws://127.0.0.1:8090",
ws: true,
},
"/api": "http://127.0.0.1:8090",
},
},
css: {
Expand Down
13 changes: 13 additions & 0 deletions client/packages/openblocks/public/cc/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script src="/cc/js/babel.min.js"></script>
<title>Custom Component</title>
<script defer="defer" src="/cc/js/runtime.js"></script>
<script defer="defer" src="/cc/js/main.js"></script>
</head>
<body></body>
</html>
2 changes: 2 additions & 0 deletions client/packages/openblocks/public/cc/js/babel.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 792371e

Please sign in to comment.