Skip to content

Commit

Permalink
docs(api): document import.meta (#3956)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxsan committed Sep 19, 2020
1 parent 5471307 commit de88955
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/content/api/module-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ contributors:
- EugeneHlushko
- wizardofhogwarts
- anikethsaha
- chenxsan

related:
- title: CommonJS
Expand Down Expand Up @@ -89,6 +90,25 @@ Depending on the configuration option `node.__dirname`:

If used inside an expression that is parsed by the Parser, the configuration option is treated as `true`.

### `import.meta.url`

Returns the absolute `file:` URL of the module.

__src/index.js__

```javascript
console.log(import.meta.url); // output something like `file:///path/to/your/project/src/index.js`
```
### `import.meta.webpack`
Returns the webpack version.
__src/index.js__
```javascript
console.log(import.meta.webpack); // output `5` for webpack 5
```
### `__filename` (NodeJS)
Expand Down

1 comment on commit de88955

@vercel
Copy link

@vercel vercel bot commented on de88955 Sep 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.