Skip to content

feat(create-webpack-app): stop asking about HTML and CSS - #4836

Open
alexander-akait wants to merge 4 commits into
mainfrom
claude/webpack-app-creation-eqhi64
Open

feat(create-webpack-app): stop asking about HTML and CSS#4836
alexander-akait wants to merge 4 commits into
mainfrom
claude/webpack-app-creation-eqhi64

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Summary

#4833 moved the init templates onto webpack's built-in HTML and CSS support, but the questions about them stayed. Since webpack handles both out of the box, init no longer asks 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 and a stylesheet is always scaffolded. One question remains for the preprocessors webpack does not cover (SASS/LESS/Stylus), wired through a type: "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: baseUrl for the Vue TypeScript paths (TS5090), a fully specified ./router/index.js import under "type": "module", and Svelte 5's mount() instead of new 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.js gains a case asserting the HTML/CSS questions are gone and that the generated config and dependencies carry no html-webpack-plugin/css-loader/mini-css-extract-plugin, plus a case covering the preprocessor path (type: "css/auto" with only sass-loader); the prompt sequences and snapshots are updated. Beyond the suite, each template was generated and production-built, and the emitted dist/index.html loaded 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, isPostCSS and html answers are replaced by a single cssPreprocessor answer — 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.md notes that every template relies on webpack's built-in HTML and CSS support, and each template's generated README.md explains 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

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-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 606178d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-webpack-app Minor

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

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (606178d).

Install it locally:

  • npm
npm i -D create-webpack-app@https://pkg.pr.new/create-webpack-app@606178d webpack-cli@https://pkg.pr.new/webpack-cli@606178d
  • yarn
yarn add -D create-webpack-app@https://pkg.pr.new/create-webpack-app@606178d webpack-cli@https://pkg.pr.new/webpack-cli@606178d
  • pnpm
pnpm add -D create-webpack-app@https://pkg.pr.new/create-webpack-app@606178d webpack-cli@https://pkg.pr.new/webpack-cli@606178d

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.24561% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.78%. Comparing base (a2418aa) to head (606178d).

Files with missing lines Patch % Lines
.../create-webpack-app/src/generators/init/default.ts 98.52% 1 Missing ⚠️
...es/create-webpack-app/src/generators/init/react.ts 98.14% 1 Missing ⚠️
...s/create-webpack-app/src/generators/init/svelte.ts 98.07% 1 Missing ⚠️
...ages/create-webpack-app/src/generators/init/vue.ts 98.07% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4836      +/-   ##
==========================================
+ Coverage   93.37%   94.78%   +1.40%     
==========================================
  Files          14       14              
  Lines        5407     5391      -16     
  Branches      790      799       +9     
==========================================
+ Hits         5049     5110      +61     
+ Misses        356      280      -76     
+ Partials        2        1       -1     
Files with missing lines Coverage Δ
packages/create-webpack-app/src/index.ts 97.10% <100.00%> (-0.07%) ⬇️
.../create-webpack-app/src/generators/init/default.ts 97.63% <98.52%> (+4.43%) ⬆️
...es/create-webpack-app/src/generators/init/react.ts 97.58% <98.14%> (+10.54%) ⬆️
...s/create-webpack-app/src/generators/init/svelte.ts 97.39% <98.07%> (+11.18%) ⬆️
...ages/create-webpack-app/src/generators/init/vue.ts 97.66% <98.07%> (+10.10%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2418aa...606178d. 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.

…ssor

The single CSS question now lists every tool webpack does not cover itself:
PostCSS, Sass, Less, Stylus, and each preprocessor combined with PostCSS.
A preprocessor rule then reads `use: ["postcss-loader", "sass-loader"]`, which
webpack applies right to left, so the stylesheet is compiled first and PostCSS
runs over the result. PostCSS also scaffolds `postcss.config.js` — in every
template now, not just the default one — and asks for `experiments.css`, since
its `.css` rule turns the automatic detection off.

Covers the answer handling with a test that builds each generator's action
list without running it, so all four templates and all eight answers are
exercised in a second instead of an install apiece.
The default template no longer installs ts-loader or registers a rule for it:
webpack strips the types itself. `typescript` stays for the editor and for the
`check:types` script (`tsc --noEmit`, since the build type checks nothing),
`tsconfig.json` gains `noEmit`, and `package.json` records the Node.js floor
type stripping needs. This also gets the template off ts-loader 9, which
crashes on TypeScript 7.

The React, Vue and Svelte templates keep ts-loader: stripping handles neither
`.tsx` nor the single-file components those loaders produce.
Type stripping is erasable syntax only and checks nothing, so a project that
wants type checking, decorators, enums or `.tsx` still needs a loader. The
default template asks which to use and defaults to webpack's built-in support;
`ts-loader` restores the rule and the dependency.

Every template that installs ts-loader now pins `typescript@5` with it: its
latest release declares `typescript: "*"` but throws `Cannot read properties
of undefined (reading 'fileExists')` on TypeScript 7. `tsconfig.json` also
loses `noEmit`, which stopped ts-loader from emitting anything; `check:types`
passes the flag itself.
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.

1 participant