tiny-engine icon indicating copy to clipboard operation
tiny-engine copied to clipboard

fix:[Bug]: Tiny Engine CLI形式process is not undefined #1521

Open sela0629 opened this issue 4 months ago • 3 comments

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • [ ] The commit message follows our Commit Message Guidelines
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)
  • [ ] Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Documentation content changes
  • [ ] Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • [ ] Yes
  • [ ] No

Other information

修复 https://github.com/opentiny/tiny-engine/issues/1521 问题,请采纳,避免每次安装新版本需要执行patch 兼容错误。

Summary by CodeRabbit

  • Bug Fixes
    • Prevented a rare initialization error on the Canvas page by ensuring browser-safe environment variables, improving startup reliability and compatibility with certain integrations.
  • Chores
    • Updated the Canvas initialization to include a lightweight environment shim for better cross-environment stability.

sela0629 avatar Aug 23 '25 03:08 sela0629

Walkthrough

A script tag was inserted into packages/canvas/init-canvas/canvas.html to define window.process with an empty env object. It was placed after the meta viewport tag and before the IMPORT_MAP/IMPORT_STYLE blocks. No exported or public entities were changed.

Changes

Cohort / File(s) Summary of Changes
Canvas HTML bootstrapping
packages/canvas/init-canvas/canvas.html
Inserted a head script initializing window.process = { env: {} } between the viewport meta and import blocks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A nibble of script in the moonlit DOM,
I set env to {}, calm and calm.
Hops through head, before imports sing,
A tiny tweak—what joy it’ll bring!
Thump-thump, ship it—springy wing. 🐇✨

[!TIP]

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Aug 23 '25 03:08 coderabbitai[bot]

https://github.com/opentiny/tiny-engine/blob/f5fb03619faf846c609322b96be79f4e860bbf7e/packages/canvas/scripts/canvas-vite.config.ts#L18

在这里加:

defineConfig({
     define: {
        process: {
          env: {}
        }
    },
})

chilingling avatar Sep 17 '25 08:09 chilingling

Bot detected the issue body's language is not English, translate it automatically.


https://github.com/opentiny/tiny-engine/blob/f5fb03619faf846c609322b96be79f4e860bbf7e/packages/canvas/scripts/canvas-vite.config.ts#L18

Add here:

defineConfig({
     define: {
        process: {
          env: {}
        }
    },
})

Issues-translate-bot avatar Sep 17 '25 08:09 Issues-translate-bot