Doesn't fix modules that use import.meta.url #2

Open
opened 3 years ago by dylang · 0 comments
dylang commented 3 years ago

This code will still fail:

// This works
import {fileURLToPath} from 'node:url';

// This fails because of import.meta.url
const __dirname = path.dirname(fileURLToPath(import.meta.url));

https://github.com/sindresorhus/term-size/blob/main/index.js#L6

The error is:

SyntaxError: Cannot use 'import.meta' outside a module
This code will still fail: ```ts // This works import {fileURLToPath} from 'node:url'; // This fails because of import.meta.url const __dirname = path.dirname(fileURLToPath(import.meta.url)); ``` https://github.com/sindresorhus/term-size/blob/main/index.js#L6 The error is: ``` SyntaxError: Cannot use 'import.meta' outside a module ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joepie91/fix-esm#2
Loading…
There is no content yet.