Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in __dirname and __filename options #7139

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/content/configuration/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,26 @@ Options:

## node.\_\_filename

`boolean` `'mock' | 'warn-mock' | 'node_module' | 'eval-only'`
`boolean` `'mock' | 'warn-mock' | 'node-module' | 'eval-only'`

Options:

- `true`: The filename of the **input** file relative to the [`context` option](/configuration/entry-context/#context).
- `false`: Webpack won't touch your `__filename` code, which means you have the regular Node.js `__filename` behavior. The filename of the **output** file when run in a Node.js environment.
- `'mock'`: The fixed value `'/index.js'`.
- `'warn-mock'`: Use the fixed value of `'/index.js'` but show a warning.
- `node_module`: Replace `__filename` in CommonJS modules to `fileURLToPath(import.meta.url)` when `output.module` is enabled.
- `'node-module'`: Replace `__filename` in CommonJS modules to `fileURLToPath(import.meta.url)` when `output.module` is enabled.
- `'eval-only'`

## node.\_\_dirname

`boolean` `'mock' | 'warn-mock' | 'node_module' | 'eval-only'`
`boolean` `'mock' | 'warn-mock' | 'node-module' | 'eval-only'`

Options:

- `true`: The dirname of the **input** file relative to the [`context` option](/configuration/entry-context/#context).
- `false`: Webpack won't touch your `__dirname` code, which means you have the regular Node.js `__dirname` behavior. The dirname of the **output** file when run in a Node.js environment.
- `'mock'`: The fixed value `'/'`.
- `'warn-mock'`: Use the fixed value of `'/'` but show a warning.
- `node_module`: Replace `__dirname` in CommonJS modules to `fileURLToPath(import.meta.url + "/..")` when `output.module` is enabled.
- `'node-module'`: Replace `__dirname` in CommonJS modules to `fileURLToPath(import.meta.url + "/..")` when `output.module` is enabled.
- `'eval-only'`