refactor(template): convert the default template from CMJs to esm#4709
Conversation
🦋 Changeset detectedLatest commit: 1edb5f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
alexander-akait
left a comment
There was a problem hiding this comment.
You need to update all test cases, not just change it in template
|
@alexander-akait test cases updated |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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.
🚀 New features to boost your workflow:
|
alexander-akait
left a comment
There was a problem hiding this comment.
Let's covert all templates in init, not only default, because we recommend to use ECMA modules everywhere
|
Got it |
…stcases - Add "type": "module" to package.json - Convert Webpack configs for React, Vue, and Svelte to ESM syntax - Polyfill __dirname/ __filename for ESM compatibility - Fix missing VueLoaderPlugin import in Vue template - Update test cases snapshot
|
@alexander-akait I've also add |
alexander-akait
left a comment
There was a problem hiding this comment.
Please use the same quotes - " everywhere in templates
…") for consistency
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,