Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Sep 16, 2023
1 parent a48a30c commit c4d9127
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/middleware/global_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ export default class implements ApplicationLifecycle {
}
if (pkg.type === 'module') {
// use ts-node/esm loader on esm
addNodeOptionsToEnv(`--loader ${require.resolve('ts-node/esm')}`, ctx.env);
let esmLoader = require.resolve('ts-node/esm');
if (process.platform === 'win32') {
// ES Module loading with abolute path fails on windows
// https://github.com/nodejs/node/issues/31710#issuecomment-583916239
esmLoader = `file://${esmLoader}`;
}
addNodeOptionsToEnv(`--loader ${esmLoader}`, ctx.env);
}

debug('set NODE_OPTIONS: %o', ctx.env.NODE_OPTIONS);
Expand Down

0 comments on commit c4d9127

Please sign in to comment.