env
Documentation / @wtf/project-resolve / env
The environment of a process started without the resolve hook: withoutHook, a process’s
environment with each --import of ./register taken out of NODE_OPTIONS.
Every process another starts inherits NODE_OPTIONS, and Node imports the hook as it starts,
from the process’s own working folder. A process in a folder of its own, where
@wtf/project-resolve is not installed, as npm packing a copy of a package, fails to start
under it. A process that reads the workspace’s packages from their source keeps the hook.
import { spawnSync } from 'node:child_process'
import { withoutHook } from '@wtf/project-resolve/env'
spawnSync('npm', ['pack'], { cwd: copy, env: withoutHook(process.env) })It is given the environment, and imports nothing, so it loads in any runtime.
