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

support for import.meta #5356

Closed
johndeighan opened this issue Jun 21, 2021 · 4 comments
Closed

support for import.meta #5356

johndeighan opened this issue Jun 21, 2021 · 4 comments

Comments

@johndeighan
Copy link

bug report - it's not listed under Unsupported ECMAScript Features

Input Code

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

__dirname = dirname(fileURLToPath(import.meta.url));

Expected Behavior

This should give us the equivalent to __dirname in common js

Current Behavior

Error message for the period after import in the last line

Possible Solution

Should work as it does in ECMAScript, or at least be listed as not compatible

Context

As a workaround, I put the import.meta.url inside backquotes so coffeescript uses it as is.
But I'm not sure yet whether that always works.

Environment

  • CoffeeScript version: CoffeeScript version 2.5.1
  • Node.js version: v16.2.0
@wdavidw
Copy link

wdavidw commented Aug 31, 2021

This is the first time in 10 years that I am using the backquote behavior, thanks for the temporary solution.

@edemaine
Copy link
Contributor

It looks like this bug was fixed by #5324 (June 3, 2020) but that CoffeeScript hasn't released since then (v2.5.1 was released on NPM on January 31, 2020). Probably worth a new release?

@GeoffreyBooth
Copy link
Collaborator

Yeah. There’s also top-level await that we need to support.

@GeoffreyBooth
Copy link
Collaborator

Resolved in #5374.

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

4 participants