Skip to content

Conversation

@Kritank07
Copy link

Title:
docs: fix webpack.config.js example for __dirname issue

Description:
The current Getting Started guide example uses __dirname in an ES module context, which can cause errors in modern Node.js environments because __dirname is not defined in ESM.

This PR:
"Clarifies the correct CommonJS usage"
"Adds a short note and example for using __dirname in ES modules"

@vercel
Copy link

vercel bot commented Jan 3, 2026

@Kritank07 is attempting to deploy a commit to the OpenJS Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 3, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.


```javascript
import path from 'path';
```js
Copy link
Member

Choose a reason for hiding this comment

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

keep the old pragma


export default {
entry: './src/index.js',
module.exports = {
Copy link
Member

Choose a reason for hiding this comment

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

instead of removing the logic here, move the __dirname logic below the import. Dont delete the es module expamples, we are transitioning from cjs -> esm

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback — got it 👍
I’ll keep the original javascript code fence pragma and move the __dirname logic below the import instead of removing the ESM example.
I’ll update the PR accordingly.


export default {
entry: './src/index.js',
entry: "./src/index.js",
Copy link
Member

Choose a reason for hiding this comment

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

Nearly there! Dont change the string literals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants