cloudflare / cloudflare/workerd

Feature request: (intermediate value).require is not a function / import.meta is not supported

Open
#2,963 13 comments 4 reactions 0 assignees View on GitHub
feature request nodejs compat web platform
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

### Which Cloudflare product(s) does this pertain to?

Workers Runtime

### What version(s) of the tool(s) are you using?

3.17.1

### What version of Node are you using?

_No response_

### What operating system are you using?

Mac

### Describe the Bug

[ERROR] service core:user:my-app: Uncaught TypeError: (intermediate value).require is not a function

at index.js:43523:22 in __require2

The problem is that my code / the generated bundle uses:

```js
var __require = id => {
return import.meta.require(id)
}
```

And workerd provides an empty object for import.meta, thus import.meta.require is undefined and not a function.

### Please provide a link to a minimal reproduction

_No response_

### Please provide any relevant error logs

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.