-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
docs: fix webpack.config.js example for ESM and CommonJS #7735
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
base: main
Are you sure you want to change the base?
Conversation
|
@Kritank07 is attempting to deploy a commit to the OpenJS Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
|
||
| ```javascript | ||
| import path from 'path'; | ||
| ```js |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
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"