Skip to content

Commit

Permalink
move module outside of TS_NODE_COMPILER process env
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanpowell88 committed Aug 10, 2023
1 parent 88d8322 commit 0bc6c0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions packages/server/lib/plugins/child/ts_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const getTsNodeOptions = (tsPath, registeredFile) => {
* we need to only set options that are supported in this version of TypeScript.
*/
const compilerOptions = {
module: 'commonjs',
...(semver.satisfies(version, '>=4.5.0')
// Only adding this option for TS >= 4.5.0
? { preserveValueImports: false }
Expand All @@ -35,9 +36,6 @@ const getTsNodeOptions = (tsPath, registeredFile) => {
try {
// @ts-ignore - compilerOptions is an object we can assign properties on.
// It's the 'tsconfig.compilerOptions'.
compilerOptions.module = 'commonjs'
// @ts-ignore - moduleResolution is an object we can assign properties on.
// It's the 'tsconfig.compilerOptions'.
compilerOptions.moduleResolution = 'node'
compiler = require.resolve(process.env.TS_NODE_COMPILER, { paths: [path.dirname(registeredFile)] })
} catch {
Expand Down
5 changes: 4 additions & 1 deletion packages/server/test/unit/plugins/child/ts_node_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ describe('lib/plugins/child/ts_node', () => {
transpileOnly: true,
compiler: 'typescript/lib/typescript.js',
dir: '/path/to/plugins',
compilerOptions: {},
compilerOptions: {
module: 'commonjs',
},
ignore: [
'(?:^|/)node_modules/',
'/packages/telemetry/dist/span-exporters/ipc-span-exporter',
Expand All @@ -41,6 +43,7 @@ describe('lib/plugins/child/ts_node', () => {
compiler: 'typescript/lib/typescript.js',
dir: '/path/to/plugins',
compilerOptions: {
module: 'commonjs',
preserveValueImports: false,
},
ignore: [
Expand Down

0 comments on commit 0bc6c0a

Please sign in to comment.