Skip to content

Add support for CommonJS require.extensions #342

Open
@hansjorg

Description

@hansjorg

See: https://nodejs.org/api/modules.html#modules_require_extensions

This is currently deprecated in Node.js, but several prominent JavaScript projects are using it, with no plans to migrate to anything else.

One example is the popular UI framework Svelte. Here's a recent issue asking about use of require.extensions:

sveltejs/svelte#5335

require.extensions is deprecated, but extremely unlikely to ever be removed any time soon. There are better ways to structure your app so that compilation happens beforehand, but there isn't really a better way to compile on demand when the require() happens. We can't stop using this without removing a feature from Svelte, which would be a breaking change.

Would you accept a PR for adding this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions