Skip to content

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

Open

Description

@schettn

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:

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

Activity

  1. added
    bug
    on Nov 23, 2023
  2. added
    bug
    feature request
    and removed
    bug
    on Oct 22, 2024
  3. jasnell commented on Oct 22, 2024

    @jasnell
    Collaborator

    Relabeling this as a feature request. We do not currently implement anything on import.meta.

  4. changed the title [-]🐛 BUG: (intermediate value).require is not a function / import.meta is not supported[/-] [+]🐛 Feature request: (intermediate value).require is not a function / import.meta is not supported[/+] on Oct 22, 2024
  5. thescientist13 commented on Dec 2, 2024

    @thescientist13

    Just wanted to share my experience with this coming out of conversations in this issue, and so hoping / looking forward to at least get support for import.meta.url 🤞

  6. removed
    bug
    on Jan 11, 2025
  7. changed the title [-]🐛 Feature request: (intermediate value).require is not a function / import.meta is not supported[/-] [+]Feature request: (intermediate value).require is not a function / import.meta is not supported[/+] on Jan 11, 2025
  8. thescientist13 commented on Feb 21, 2025

    @thescientist13

    Curious if there were any updates on this or sentiment from Cloudflare on supporting import.meta.url? I have now confirmed that in Netlify, Vercel, and AWS Lamba (using both raw upload, SST, and Architect) all have no issues with usage of import.meta.url in deployed function code, so would be great if Cloudflare could support this useful and long-standing web standard as well. 🙏


    I acknowledge Netlify and Vercel are derivatives of AWS, and they are all just running NodeJS under the hood, but I wanted to list them all individually mainly in terms of confirming that I wasn't just assuming, and incorrectly attributing support where it may not actually be there. For example, of couple of these providers / tools required opting-out of any pre / post processing they were doing, because in both cases I encountered this with; Netlify and SST, they were pre-bundling all function code with esbuild on their ends, which has had mixed support for import.meta.url and so the best results I found were where I just leveraged their systems for just putting the code in the right place for them to do their uploads / orchestration and nothing else.

    So in that regard, in terms of being able to confidently recommend support to users that "yes, this will work" I just wanted to do my due diligence, and would love to include Cloudflare in that group! (and would personally love to start using Cloudflare more myself 😊 )

    Thanks in advance! 🧡

  9. jasnell commented on Feb 21, 2025

    @jasnell
    Collaborator

    Import.meta.url will be coming this year. Don't have a more specific target yet

  10. thescientist13 commented on Feb 21, 2025

    @thescientist13

    Great, thank you for the update!

  11. astanciu commented on Jul 11, 2025

    @astanciu

    Any news on this?

  12. irvinebroque commented on Oct 26, 2025

    @irvinebroque
    Collaborator

    Re: import.meta.url — if you enable new_module_registry and experimental compatibility flags to your Worker — you'll see this implemented. Can't yet deploy to Cloudflare when using the new_module_registry compatibility flag, but we're working on that.

    Re: import.meta.require — right now that is Bun-specific, and called out in Bun docs as unstable, see: https://bun.com/reference/globals/ImportMeta/require

    Image

    refs discussion in nodejs/node#55730

  13. thescientist13 commented on Oct 28, 2025

    @thescientist13

    Thanks for the update @irvinebroque , looking forward to when this would be testable on Cloudflare 👍

  14. thescientist13 commented on Jan 17, 2026

    @thescientist13

    Just checking in on this (import.meta.url), any hope for it in 2026? 🥺

  15. fabian-hiller commented on May 20, 2026

    @fabian-hiller

    Would be great if import.meta.glob would be supported

  16. thescientist13 commented on Aug 4, 2026

    @thescientist13

    @jasnell
    Do you know if there are any updates here, in particular on import.meta.url? Thanks! 🙏

  17. jasnell commented on Aug 4, 2026

    @jasnell
    Collaborator

    Very very very soon. It was a lower priority for a while but we've been doing some final acceptance testing on the impl and should be flipping the switch in the next week or two

  18. thescientist13 commented on Aug 4, 2026

    @thescientist13

    Awesome and thank you, looking forward to it! 🙌

  19. thescientist13 commented on Oct 3, 2026

    @thescientist13

    For anyone following along, it looks like import.meta.* (and more!) is now supported, and can confirm that import.meta.url is working in my simple PoC 🎉

    Thank you!


    @jasnell
    Just a heads up, but for this link in the blog post

    You can start using it today by enabling the new_module_registry compatibility flag in your Worker.

    I get a 404 for it
    https://developers.cloudflare.com/workers/configuration/compatibility-flags/new-module-registry
    Image

  20. thescientist13 commented on Oct 3, 2026

    @thescientist13

    Hmm, getting some mixed results here, opened a dedicated issue around the compatibility flag usage - #7606

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestnodejs compatweb platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions