You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 11be634
Browse filesBrowse the repository at this point in the historyBrowse files
feat(create-webpack-app): stop asking about HTML and CSS (#4836)
* feat(create-webpack-app): stop asking about HTML and CSS
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.
* feat(create-webpack-app): keep PostCSS, on its own or over a preprocessor
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.
* feat(create-webpack-app): scaffold TypeScript on webpack's own support
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.
* feat(create-webpack-app): ask how TypeScript should be compiled
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.
* feat(create-webpack-app): say what each TypeScript compiler choice means
"built-in" and "ts-loader" named the mechanism but not the trade-off, so the
prompt now spells it out: webpack strips types with no type checking and needs
Node.js >= 22.6, while ts-loader type checks as it builds and handles `.tsx`,
enums and decorators. The stored answers are unchanged.
* feat(create-webpack-app): pin typescript@6 with ts-loader, not typescript@5
6.0.3 is the last release of the JavaScript line, and ts-loader 9 builds and
type checks against it; only TypeScript 7, the native port, breaks it. Pinning
the newest version that works keeps the scaffold current.
* fix(create-webpack-app): drop the Vue baseUrl that TypeScript 6 rejects
`baseUrl` is deprecated in TypeScript 6, so every module in the Vue
TypeScript project failed with TS5101 once the pin moved to 6. A `paths`
mapping needs no `baseUrl` when it is relative, which is also what fixed
the TS5090 the option was added for.
feat: stop asking about HTML and CSS in `init`, scaffold TypeScript on webpack's own support, and keep one question for the CSS tools webpack does not cover (PostCSS, Sass, Less, Stylus, and each preprocessor with PostCSS)
0 commit comments