Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Deal with mjs file #1408

Closed
jim-king-2000 opened this issue Nov 18, 2021 · 1 comment
Closed

Deal with mjs file #1408

jim-king-2000 opened this issue Nov 18, 2021 · 1 comment

Comments

@jim-king-2000
Copy link

When I use pkg to package a mjs file, the executable can be generated successfully. But when I run it, there is an error message:

node:internal/modules/cjs/loader:979
    throw new ERR_REQUIRE_ESM(filename, true);
    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\snapshot\testpkg\app.mjs not supported.
Instead change the require of C:\snapshot\testpkg\app.mjs to a dynamic import() which is available in all CommonJS modules.
    at Function.runMain (pkg/prelude/bootstrap.js:1847:12) {
  code: 'ERR_REQUIRE_ESM'
}

Any resolution?

@robertsLando
Copy link
Contributor

robertsLando commented Nov 24, 2021

pkg doesn't support esm yet. There are already issues related to this so I'm going to close this

#1291

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants