Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Works in vite configs for resolver alias: resolve: { alias: [ { find: "@", replacement: path.resolve("src"), }, ], }, Commented Mar 9, 2022 at 22:08
  • 1
    Unfortunately, this is not an equivalent for __dirname. __dirname is always relative to the file you call __dirname from. resolve() gives you a URL relative to the directory which you run the file from (current working directory), which can be the same, but is very often different. Commented Oct 22, 2022 at 11:48