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

Flow is not compatible with ESM (ES6 Node Modules) #164

Closed
sheerlox opened this issue Jul 24, 2019 · 2 comments
Closed

Flow is not compatible with ESM (ES6 Node Modules) #164

sheerlox opened this issue Jul 24, 2019 · 2 comments

Comments

@sheerlox
Copy link

__filename and __dirname are no longer available with the new ESM specs.

Flow is unable to parse the new import.meta.url property, which is used to resolve __filename and __dirname:

import { fileURLToPath } from 'url'
import { dirname } from 'path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

Returns the error:

Unexpected token .

I am no longer able to type check files that require those informations.

@sheerlox
Copy link
Author

I tried to go and see if I can make a PR, I'm pretty sure it's related to this, but I have no knowledge of the ML language, and as it's a pretty abnormal language I can't even try without going through a lot of learning about it.

I think it should be a pretty simple thing to implement, and it's pretty important for the future of Node (as right now it's an experimental feature, even if we decided to enable it in production as it's pretty much stable).

@mroch
Copy link
Contributor

mroch commented Aug 11, 2019

this is being tracked in facebook/flow#6913

thanks for the report! this is useful context.

@mroch mroch closed this as completed Aug 11, 2019
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