Skip to content

Conversation

@payelcs2024ipcw-source
Copy link

@payelcs2024ipcw-source payelcs2024ipcw-source commented Dec 21, 2025

Fixes #7636

This pull request updates the Concepts and Config section of the webpack documentation to reflect the transition from CommonJS to ECMAScript Modules (ESM).

Changes made:

  • Replaced module.exports examples with export default.
  • Updated require(...) usage to import ... from .....
  • Adjusted wording in the concept explanation to clarify that webpack config files are now standard ECMAScript modules rather than CommonJS modules.
  • Added notes on ESM-specific considerations (e.g., import.meta.url for resolving paths instead of __dirname).

@vercel
Copy link

vercel bot commented Dec 21, 2025

@payelcs2024ipcw-source is attempting to deploy a commit to the OpenJS Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@evenstensberg evenstensberg left a comment

Choose a reason for hiding this comment

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

Thanks for your PR! I left a few comments that needs to be adressed. ☀️

entry: './foo.js',
output: {
path: path.resolve(__dirname, 'dist'),
path: path.resolve(process.cwd(), 'dist'),
Copy link
Member

Choose a reason for hiding this comment

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

Dont use process.cwd, use this

https://stackoverflow.com/a/50052194

@payelcs2024ipcw-source
Copy link
Author

Completed the assigned edits in the concept section and proceeded with further improvements in the config section.

@payelcs2024ipcw-source payelcs2024ipcw-source changed the title [DOCS] webpack documentation concept section from CommonJS to ESM [DOCS] webpack documentation concept and config section from CommonJS to ESM Dec 24, 2025
const pluginName = 'ConsoleLogOnBuildWebpackPlugin';

class ConsoleLogOnBuildWebpackPlugin {
export default class ConsoleLogOnBuildWebpackPlugin {

Choose a reason for hiding this comment

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

corrected the typo error

You may have noticed that few webpack configurations look exactly alike. This is because **webpack's configuration file is a JavaScript file that exports a webpack [configuration](/configuration/).** This configuration is then processed by webpack based upon its defined properties.

Because it's a standard Node.js CommonJS module, you **can do the following**:
Because it's a standard ECMAscript Module, you **can do the following**:
Copy link
Member

Choose a reason for hiding this comment

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

the S in script should be capitalized


```javascript
module.exports = {
export defualt {
Copy link
Member

Choose a reason for hiding this comment

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

wrong code


```javascript
module.exports = {
export deafult {
Copy link
Member

Choose a reason for hiding this comment

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

wrong code


```javascript
module.exports = {
export default {

Choose a reason for hiding this comment

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

apologies for the oversight earlier. I've double-checked and fixed the typo now. Please let me know if there r further any issues. Thank you.

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.

Feature Request: Update documentation examples to ES6

2 participants