Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Using esm to import esm synchronously. #922

@jakobrosenberg

Description

@jakobrosenberg

Is it possible to do something like this with esm to synchronously import esm modules?

import esm from 'esm'
import { createRequire } from "node:module";
const require = createRequire(import.meta.url)(esm)(module);


// synchronously import a file
const thing = require('./somefile.js')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions