Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App.mount is time-consuming and wants to complete the JS string parsing in advance #698

Open
2 tasks done
cjj281795819 opened this issue Feb 5, 2025 · 1 comment
Open
2 tasks done

Comments

@cjj281795819
Copy link

Clear and concise description of the problem

New Function process is time consuming, want to support early execution

Suggested solution

Garfish.registerApp(name, { ...xxx, execScriptCache: true});

async compileAndRenderContainer(renderContainer = true) {
    // Render the application node
    // If you don't want to use the CJS export, at the entrance is not can not pass the module, the require
    + if (renderContainer) {
      await this.renderTemplate();
    + }

    const execScript = (type: 'async' | 'defer') => {
      + if (this.execScriptCache.get(type)) {
        return;
      + }
    
      xxxx
      
     + if (this.appInfo.enableExecScriptCache) {
     +   this.execScriptCache.set(type, true);
     + }
    }
}

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@zhoushaw
Copy link
Member

zhoushaw commented Feb 5, 2025

This results in a disordered execution flow within the application, often causing more perplexing behavior. You might consider executing the render process before actual rendering, as mounting to a temporary node can achieve similar effects.

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

No branches or pull requests

2 participants