Skip to content

V4.0.26 onwars breaks CJS + pkg builds #1234

Closed
@otaviojacobi

Description

pkg failure in CJS projects because ESM dependency is added via a is-wsl

Steps to reproduce the behavior:
USe @oclif/core latest (or any >= 4.0.26) will suceed to build with pkg but will not be able to run as the ESM package won't be able to load/resolve with native CJS resulting in:

ERR_MODULE_NOT_FOUND: Cannot find package 'is-wsl' imported from /snapshot/balena-cli/node_modules/@oclif/core/lib/config/config.js
Did you mean to import is-wsl/index.js?

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'is-wsl' imported from /snapshot/balena-cli/node_modules/@oclif/core/lib/config/config.js
Did you mean to import is-wsl/index.js?
    at packageResolve (node:internal/modules/esm/resolve:853:9)
    at moduleResolve (node:internal/modules/esm/resolve:910:20)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:328:34)
    at importModuleDynamically (node:internal/modules/cjs/loader:1261:33)
    at importModuleDynamicallyWrapper (node:internal/vm/module:431:21)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:207:14)

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