<repo_name>marvinhagemeister/vite-dirname-bug<file_sep>/vite/plugin.ts
import { Plugin } from "vite";

export function myPlugin(): Plugin {
  console.log("PLUGIN_DIR", __dirname);
  return {
    name: "dirname",
  };
}
<file_sep>/vite.config.ts
import { defineConfig } from "vite";
import { myPlugin } from "./vite/plugin";

console.log("CONFIG_DIR and PLUGIN_DIR should be different");
console.log("CONFIG_DIR", __dirname);

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [myPlugin()],
});
<file_sep>/README.md
# Vite plugin dirname bug

## Expected Result

Using `__dirname` inside a plugin points to the dirname of that file instead of the dirname of `vite.config.ts`.

## Actual Result

`__dirname` points to the directory that `vite.config.ts` resides in, regardless of where the plugin file is placed.

## Steps to reproduce:

1. Clone this repo
2. Run `npm install`
3. Run `npm start` -> Check terminal output
