| 12 | const appPath = join(__dirname, '..') |
| 13 | |
| 14 | export async function buildStudio({ outDir, configPath, base }: BuildOpts) { |
| 15 | // Set NODE_ENV to production before importing React to ensure consistent builds |
| 16 | process.env.NODE_ENV = 'production' |
| 17 | |
| 18 | const astro = await import('astro') |
| 19 | const { default: react } = await import('@astrojs/react') |
| 20 | const { default: studio } = await import('@pandacss/astro-plugin-studio') |
| 21 | |
| 22 | try { |
| 23 | process.env.PUBLIC_CONFIG_PATH = configPath |
| 24 | await astro.build({ |
| 25 | outDir, |
| 26 | root: appPath, |
| 27 | integrations: [react(), studio()], |
| 28 | devToolbar: { enabled: false }, |
| 29 | base, |
| 30 | }) |
| 31 | } catch (error) { |
| 32 | console.log(error) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | export async function serveStudio({ configPath, port, host, outDir, base }: BuildOpts) { |
| 37 | const astro = await import('astro') |