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

TypeScript interop needs tweaking #626

Closed
guybedford opened this issue Dec 15, 2020 · 2 comments
Closed

TypeScript interop needs tweaking #626

guybedford opened this issue Dec 15, 2020 · 2 comments

Comments

@guybedford
Copy link
Contributor

The exact example at https://github.com/Timer/bundle-subasset does not actually work because the following TypeScript:

import path from 'path';
path.resolve(...)

is transpiled by TypeScript into:

const path = require('path');
path["default"].resolve(...)

which is clearly incorrect.

It does work if you use import * as path from 'path'.

We should adjust the TypeScript emission to use proper Node.js interop, which is a breaking change to make.

@sarink
Copy link

sarink commented Dec 15, 2020

Is there any workaround that doesn't involve rewriting your imports?

@guybedford
Copy link
Contributor Author

Fixed in #671.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants