Skip to content

Commit

Permalink
docs(config-file): update tip note about string replace (#7846)
Browse files Browse the repository at this point in the history
  • Loading branch information
jprando authored May 9, 2022
1 parent e56d79e commit d7c04e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ vite --config my-config.js
```

::: tip NOTE
Vite will replace `__filename`, `__dirname`, and `import.meta.url` in config files and its deps. Using these as variable names will result in an error:
Vite will replace `__filename`, `__dirname`, and `import.meta.url` in config files and its deps. Using these as variable names or passing as a parameter to a function with string double quote (example `console.log`) will result in an error:

```js
const __filename = "value"
// will be transformed to
const "path/vite.config.js" = "value"

console.log("import.meta.url") // break error on build
```

:::
Expand Down

0 comments on commit d7c04e8

Please sign in to comment.