Skip to content

refactor(template): convert the default template from CMJs to esm#4709

Open
ThierryRakotomanana wants to merge 2 commits intowebpack:mainfrom
ThierryRakotomanana:refactor/default-config-to-esm
Open

refactor(template): convert the default template from CMJs to esm#4709
ThierryRakotomanana wants to merge 2 commits intowebpack:mainfrom
ThierryRakotomanana:refactor/default-config-to-esm

Conversation

@ThierryRakotomanana
Copy link

@ThierryRakotomanana ThierryRakotomanana commented Mar 18, 2026

Summary

Currently, the official Getting Started using quick start minimal uses ES Modules (ESM) syntax. However, the command npx create-webpack-app still generates a webpack.config.js using CommonJS (require/module.exports). This creates a confusing experience for new users.

This PR rectifies webpack.config.js tempate to generate an ES Modules config by default.

What kind of change does this PR introduce?

It's refactor, I refactor the default config template
Did you add tests for your changes?
I've updated all test cases,

Does this PR introduce a breaking change?
Not really, just an update

If relevant, what needs to be documented once your changes are merged or what have you already documented?

Use of AI
No need,

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2026

⚠️ No Changeset found

Latest commit: 92d8f3f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

You need to update all test cases, not just change it in template

@ThierryRakotomanana
Copy link
Author

@alexander-akait test cases updated

@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.43%. Comparing base (49efdc0) to head (92d8f3f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4709   +/-   ##
=======================================
  Coverage   91.43%   91.43%           
=======================================
  Files          14       14           
  Lines        4716     4716           
  Branches      679      679           
=======================================
  Hits         4312     4312           
  Misses        402      402           
  Partials        2        2           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49efdc0...92d8f3f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Let's covert all templates in init, not only default, because we recommend to use ECMA modules everywhere

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