Skip to content

enable eval() and new Function on startup#4142

Merged
anonrig merged 1 commit intomainfrom
yagiz/add-eval-new-function
May 13, 2025
Merged

enable eval() and new Function on startup#4142
anonrig merged 1 commit intomainfrom
yagiz/add-eval-new-function

Conversation

@anonrig
Copy link
Member

@anonrig anonrig commented May 13, 2025

Enables the usage of eval() and new Function() on startup phase of the main module. Potentially enabling libraries such as Fastify to be used within Cloudflare Workers.

Starting June 1st, 2025, the following code works:

strictEqual(eval('1+1'), 2);
// or even this
strictEqual((await import('module-that-has-eval-in-it)).default, 2);

export default {
  async fetch(request, env, ctx) {
    return new Response('Hello World!');
  },
};

@anonrig anonrig requested review from a team as code owners May 13, 2025 16:50
@hoodmane
Copy link
Contributor

This looks helpful.

@anonrig anonrig force-pushed the yagiz/add-eval-new-function branch 3 times, most recently from f01c747 to 5477109 Compare May 13, 2025 19:47
@anonrig anonrig force-pushed the yagiz/add-eval-new-function branch from 5477109 to e306775 Compare May 13, 2025 20:07
@anonrig anonrig force-pushed the yagiz/add-eval-new-function branch from e306775 to 575f7d3 Compare May 13, 2025 20:11
@anonrig anonrig requested a review from danlapid May 13, 2025 20:12
@anonrig anonrig force-pushed the yagiz/add-eval-new-function branch from 575f7d3 to 92862f4 Compare May 13, 2025 20:12
@anonrig anonrig requested review from jasnell and kentonv May 13, 2025 20:12
@anonrig anonrig changed the title enable eval() and new Function on bootstrap enable eval() and new Function on startup May 13, 2025
@anonrig anonrig force-pushed the yagiz/add-eval-new-function branch from 92862f4 to 6fc82d5 Compare May 13, 2025 20:18
@anonrig anonrig enabled auto-merge (squash) May 13, 2025 20:23
@anonrig anonrig disabled auto-merge May 13, 2025 21:01
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.

5 participants