feat(create-webpack-app): stop asking about HTML and CSS - #4836
feat(create-webpack-app): stop asking about HTML and CSS#4836alexander-akait wants to merge 1 commit into
Conversation
webpack handles both out of the box, so the templates no longer ask whether to simplify HTML creation, which CSS solution to use, whether PostCSS is wanted or whether CSS should be extracted. `index.html` is always the entry point, a stylesheet is always scaffolded, and one question remains for the preprocessors webpack does not cover, wired through a `type: "css/auto"` rule that adds only sass-loader/less-loader/stylus-loader. Also fixes what the generated projects needed to build and run: `baseUrl` for the Vue TypeScript `paths`, a fully specified `./router/index.js` import under `"type": "module"`, Svelte 5's `mount()` instead of `new App()`, and style-module declarations for the TypeScript templates.
🦋 Changeset detectedLatest commit: 3e984e0 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 |
|
This PR is packaged and the instant preview is available (3e984e0). Install it locally:
npm i -D create-webpack-app@https://pkg.pr.new/create-webpack-app@3e984e0 webpack-cli@https://pkg.pr.new/webpack-cli@3e984e0
yarn add -D create-webpack-app@https://pkg.pr.new/create-webpack-app@3e984e0 webpack-cli@https://pkg.pr.new/webpack-cli@3e984e0
pnpm add -D create-webpack-app@https://pkg.pr.new/create-webpack-app@3e984e0 webpack-cli@https://pkg.pr.new/webpack-cli@3e984e0 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4836 +/- ##
==========================================
+ Coverage 93.37% 93.87% +0.49%
==========================================
Files 14 14
Lines 5407 5255 -152
Branches 790 773 -17
==========================================
- Hits 5049 4933 -116
+ Misses 356 321 -35
+ Partials 2 1 -1
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Summary
#4833 moved the
inittemplates onto webpack's built-in HTML and CSS support, but the questions about them stayed. Since webpack handles both out of the box,initno longer asks whether to simplify HTML creation, which CSS solution to use, whether PostCSS is wanted, or whether CSS should be extracted:index.htmlis always the entry point and a stylesheet is always scaffolded. One question remains for the preprocessors webpack does not cover (SASS/LESS/Stylus), wired through atype: "css/auto"rule that adds only the preprocessor loader. The default template goes from 9 questions to 5. Refs #4833.Generating and building each template also surfaced three defects that predate both PRs and are fixed here:
baseUrlfor the Vue TypeScriptpaths(TS5090), a fully specified./router/index.jsimport under"type": "module", and Svelte 5'smount()instead ofnew App(), which rendered a blank page.What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes —
test/create-webpack-app/init/init.test.jsgains a case asserting the HTML/CSS questions are gone and that the generated config and dependencies carry nohtml-webpack-plugin/css-loader/mini-css-extract-plugin, plus a case covering the preprocessor path (type: "css/auto"with onlysass-loader); the prompt sequences and snapshots are updated. Beyond the suite, each template was generated and production-built, and the emitteddist/index.htmlloaded in Chromium: every one renders with its stylesheet applied and no page errors, SASS/LESS variants included.Does this PR introduce a breaking change?
No for generated projects. The prompts change, so the
cssType,isCSS,isPostCSSandhtmlanswers are replaced by a singlecssPreprocessoranswer — this only affects anything driving the generator with pre-supplied answers.If relevant, what needs to be documented once your changes are merged or what have you already documented?
Documented in this PR:
packages/create-webpack-app/README.mdnotes that every template relies on webpack's built-in HTML and CSS support, and each template's generatedREADME.mdexplains that the page is the entry point and how to add a preprocessor.Use of AI
Yes. Claude Code made the template and generator edits and ran the verification described above — generating every template, building it, and loading the result in a browser. I reviewed the diff and the verification output before submitting.
Generated by Claude Code