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: Alias --es-module-specifier-resolution to --experimental-specifier-resolution for Node 12 compatibility #1122

Merged
merged 2 commits into from Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion dist-raw/node-options.js
Expand Up @@ -25,7 +25,9 @@ function parseArgv(argv) {
'--preserve-symlinks': Boolean,
'--preserve-symlinks-main': Boolean,
'--input-type': String,
'--experimental-specifier-resolution': String
'--experimental-specifier-resolution': String,
// Legacy alias for node versions prior to 12.16
'--es-module-specifier-resolution': '--experimental-specifier-resolution',
}, {
argv,
permissive: true
Expand Down
2 changes: 1 addition & 1 deletion esm-usage-example/package.json
@@ -1,7 +1,7 @@
{
"type": "module",
"dependencies": {
"ts-node": "github:TypeStrong/ts-node#ab/esm-support",
"ts-node": "github:TypeStrong/ts-node#master",
"typescript": "^3.8.3"
}
}
8 changes: 8 additions & 0 deletions src/index.spec.ts
Expand Up @@ -887,6 +887,14 @@ describe('ts-node', function () {
return done()
})
})
it('via --es-module-specifier-resolution alias', (done) => {
exec(`${cmd} --experimental-modules --es-module-specifier-resolution=node index.ts`, { cwd: join(__dirname, '../tests/esm-node-resolver') }, function (err, stdout) {
expect(err).to.equal(null)
expect(stdout).to.equal('foo bar baz biff\n')

return done()
})
})
it('via NODE_OPTIONS', (done) => {
exec(`${cmd} index.ts`, {
cwd: join(__dirname, '../tests/esm-node-resolver'),
Expand Down