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

fix(module-runner): delay function eval until module runner instantiation #18480

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Oct 27, 2024

Description

While trying to avoid bundling vite/module-runner in my workerd package hi-ogawa/vite-environment-examples#143, I found that new AsyncFunction('a', 'b', body) executed during import side effect causes an error since normal eval is not supported in the environment.

In hi-ogawa/vite-environment-examples#143, I manually removed new AsyncFunction from the source code to make it work. Though I'm not sure we'll be recommending not bundling module runner, delaying this function eval won't probably hurt anything.

I tested with a local build and confirmed that new AsyncFunction removal isn't necessary after this change.

@hi-ogawa hi-ogawa marked this pull request as ready for review October 27, 2024 07:01
@sapphi-red sapphi-red added the feat: environment API Vite Environment API label Oct 28, 2024
@patak-dev patak-dev merged commit 472afbd into vitejs:main Oct 28, 2024
19 checks passed
@hi-ogawa hi-ogawa deleted the fix-no-function-eval-on-import branch October 29, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: environment API Vite Environment API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants