Skip to content

Commit 4dba8e8

Browse files
fix: Alias --es-module-specifier-resolution to --experimental-specifier-resolution for Node 12 compatibility (#1122)
* fix: Alias --es-module-specifier-resolution to --experimental-specifier-resolution for node 12 compatibility * Update node-options.js Co-authored-by: Andrew Bradley <[email protected]>
1 parent 41e7109 commit 4dba8e8

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

dist-raw/node-options.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ function parseArgv(argv) {
2525
'--preserve-symlinks': Boolean,
2626
'--preserve-symlinks-main': Boolean,
2727
'--input-type': String,
28-
'--experimental-specifier-resolution': String
28+
'--experimental-specifier-resolution': String,
29+
// Legacy alias for node versions prior to 12.16
30+
'--es-module-specifier-resolution': '--experimental-specifier-resolution',
2931
}, {
3032
argv,
3133
permissive: true

esm-usage-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "module",
33
"dependencies": {
4-
"ts-node": "github:TypeStrong/ts-node#ab/esm-support",
4+
"ts-node": "github:TypeStrong/ts-node#master",
55
"typescript": "^3.8.3"
66
}
77
}

src/index.spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,14 @@ describe('ts-node', function () {
887887
return done()
888888
})
889889
})
890+
it('via --es-module-specifier-resolution alias', (done) => {
891+
exec(`${cmd} --experimental-modules --es-module-specifier-resolution=node index.ts`, { cwd: join(__dirname, '../tests/esm-node-resolver') }, function (err, stdout) {
892+
expect(err).to.equal(null)
893+
expect(stdout).to.equal('foo bar baz biff\n')
894+
895+
return done()
896+
})
897+
})
890898
it('via NODE_OPTIONS', (done) => {
891899
exec(`${cmd} index.ts`, {
892900
cwd: join(__dirname, '../tests/esm-node-resolver'),

0 commit comments

Comments
 (0)