Skip to content

Conversation

@reyesrico
Copy link
Contributor

@reyesrico reyesrico commented Oct 26, 2025

Issue

For editor project and running npm run dev it was identified that SandoxDocumentPreview component is not rendering any text or html.

Root Cause

The Sandbox iframe tries to load assets from http://localhost:4300/chartifact/dist/v1/ but these files weren't being served by the Vite dev server.

Fix

  1. Added Cross-Platform Copy Script
    File: [copy-assets]
  • Uses only Node.js built-in modules
  • Automatically handles path separators for each OS
  • Shows friendly error message if assets aren't built yet
  • Follows same pattern as existing [copy-schema.js] scripts in the project
  1. Updated Package Scripts
    File: [package.json]
  • postbundle: Automatically copies assets after build completes
  • predev: Safety net - ensures assets exist before starting dev server
  • clean: Removes copied assets when cleaning

How It Works

Build Workflow:

# From workspace root
npm run build


# From editor directory
npm run dev

Cross-Platform ✅

  • Works on Windows, Mac, and Linux
  • Uses only Node.js built-ins (no external dependencies)
  • Follows existing project patterns

Testing

  • Delete assets: rm -rf packages/editor/public/chartifact
  • Build: [npm run build]
  • Verify assets copied to packages/editor/public/chartifact/dist/v1/
  • Start dev: npm run dev (from editor directory)
  • Document Preview should work without errors ✅

@reyesrico reyesrico changed the title Enhance build scripts: clean up dist and public/chartifact, add asset… Fix Document Preview Render for editor tool Oct 26, 2025
@danmarshall
Copy link
Collaborator

Hmmm - I got the Assets not found, run npm run build in workspace root first error.

@reyesrico
Copy link
Contributor Author

Hmmm - I got the Assets not found, run npm run build in workspace root first error.

It is now fixed with the new commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants