Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: NODE_OPTIONS should set to process.env/context.env #237

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Command extends BaseCommand {

get context() {
const context = super.context;
const { argv, debugPort, execArgvObj, cwd, env } = context;
const { argv, debugPort, execArgvObj, cwd } = context;

// compatible
if (debugPort) context.debug = debugPort;
Expand Down Expand Up @@ -130,14 +130,15 @@ class Command extends BaseCommand {
} else {
process.env.NODE_OPTIONS = requireOptions;
}
context.env.NODE_OPTIONS = process.env.NODE_OPTIONS;
// tell egg loader to load ts file
// see https://github.com/eggjs/egg-core/blob/master/lib/loader/egg_loader.js#L443
env.EGG_TYPESCRIPT = 'true';
context.env.EGG_TYPESCRIPT = 'true';
// set current process.env.EGG_TYPESCRIPT too
process.env.EGG_TYPESCRIPT = 'true';

// load files from tsconfig on startup
env.TS_NODE_FILES = process.env.TS_NODE_FILES || 'true';
context.env.TS_NODE_FILES = process.env.TS_NODE_FILES || 'true';
}

// keep same logic with egg-core
Expand Down