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

Doesn't handle node: style imports (e.g. node:path) #1309

Closed

Description

@danielnixon

It looks like pkg chokes on node:path ESM import style (see https://nodejs.org/api/esm.html#esm_node_imports).

Given some source like this:

import path from 'node:path';
import os from 'node:os';
import process from 'node:process';

pkg can't seem to find the content of that import:

> [debug] Bytecode of node:path is added to queue. It was required from <snip>/node_modules/env-paths/index.js
> [debug] Bytecode of node:os is added to queue. It was required from <snip>/node_modules/env-paths/index.js
> [debug] Bytecode of node:process is added to queue. It was required from <snip>/node_modules/env-paths/index.js
> [debug] Stat info of <snip>/node_modules/env-paths/package.json is added to queue.
> [debug] Content of <snip>/node_modules/env-paths/index.js is added to queue. It was required from <snip>/node_modules/env-paths/package.json
> [debug] Content of <snip>/node_modules/env-paths/index.d.ts is added to queue. It was required from <snip>/env-paths/package.json
> [debug] Content of <snip>/node_modules/env-paths/package.json is added to queue.
> [debug] Stat info of <snip>/node_modules/express/package.json is added to queue.

And then later:

> [debug] Directory <snip>/node_modules/env-paths is added to queue.
> [debug] Stat info of node:path is added to queue.
> [debug] Content of node:path is added to queue.
> Error! Cannot read file, ENOENT
  node:path
error Command failed with exit code 2.

See sindresorhus/env-paths#17

Activity

  1. Niek commented on Nov 13, 2021

    @Niek

    Had the same issue, if you're using esbuild here is a quick workaround:
    evanw/esbuild#1760 (comment)

  2. added a commit that references this issue on Nov 18, 2021
    061635f
  3. added a commit that references this issue on Nov 24, 2021
    1bf9be8
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions