Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"lint:libOnly": "expo-module eslint ./src",
"test": "expo-module test",
"prepare": "expo-module prepare && rm .eslintrc.js",
"postprepare": "echo '{\"type\": \"module\"}' > build/package.json",
"prepublishOnly": "expo-module prepublishOnly",
"expo-module": "expo-module",
"open:ios": "xed example/ios",
Expand Down
6 changes: 5 additions & 1 deletion plugin/src/features/ios/files/swift/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path'
import vm from 'node:vm'

import * as babel from '@babel/core'
import { renderWidgetToString, type WidgetVariants } from 'voltra/server'
import type { WidgetVariants } from 'voltra/server'

import { MODULE_EXTENSIONS } from '../../../../constants'
import type { WidgetConfig } from '../../../../types'
Expand Down Expand Up @@ -143,6 +143,10 @@ function evaluateWidgetModule(projectRoot: string, filePath: string): WidgetVari
* @returns Map of widgetId -> prerendered widget state as JSON string
*/
export async function prerenderWidgetState(widgets: WidgetConfig[], projectRoot: string): Promise<Map<string, string>> {
// Dynamic import for ESM module compatibility
// voltra/server is an ESM module, but the plugin is compiled to CommonJS
const { renderWidgetToString } = await import('voltra/server')

const prerenderedStates = new Map<string, string>()

for (const widget of widgets) {
Expand Down
Loading