Skip to content

build: complete webpack 4→5 migration (config cleanup per official guide) - #1369

Open
ilteoood wants to merge 1 commit into
mainfrom
chore/webpack5-config-migration
Open

ilteoood wants to merge 1 commit into
mainfrom
chore/webpack5-config-migration

Conversation

@ilteoood

@ilteoood ilteoood commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Completes the webpack 4 → 5 migration for this repo following the official migration guide.
Closes #1368
Closes #1338

Context: The webpack version in this repo was already bumped to 5.x over time (5.68.0 in #1087-era work, since bumped by dependabot to 5.111.1), but the guide's configuration-migration steps were never applied — our webpack configs and the create-spectacle generator still emitted webpack 4 idioms. This PR applies the remaining steps from the guide's "Clean up configuration" section:

Guide step Change
output.library / output.libraryTarget → output.library object ({ name, type }) webpack.config.base.js
Replace file-loader with Asset Modules (type: 'asset/resource') webpack.config.base.js, create-spectacle webpack template
Replace raw-loader with Asset Modules (type: 'asset/source') examples/md/webpack.config.js, create-spectacle webpack template
Upgrade webpack-cli to the latest version ^4.10.0 → ^5.1.4 (root + generated projects)
Remove deprecated loader deps Drop raw-loader from root devDependencies; drop file-loader from generated package.json

Notes:

  • webpack-cli is pinned to ^5.1.4 (not the newer 6/7 majors) because those integrate the dev-server CLI and expect webpack-dev-server 5+, while this repo is on dev-server 4 (a separate dependabot bump to 5.2.6 is already pending). webpack-cli@5 is the latest release designed purely for webpack 5 builds.
  • The create-spectacle generator previously emitted a webpack config referencing raw-loader without listing it in the generated package.json devDependencies — generated markdown decks could not build. Asset Modules need no loader package, which fixes this and removes file-loader from generated deps entirely.
  • ProvidePlugin (process/browser) and all other config options were checked against the guide; no other outdated options ([hash], optimization.* renames, Rule.query/Rule.loaders, node.fs, IgnorePlugin regexp, etc.) are in use.

Type of Change

  • Bug fix (non-breaking change which fixes an issue) — generated markdown decks were missing a needed loader dep
  • New feature
  • Breaking change
  • Documentation update

How Has This Been Tested?

  • Baseline vs. migration: all four webpack examples (js, md, mdx, typescript) compile successfully before and after; output bundles are equivalent (the md example inlines slides.md as the identical string via asset/source).
  • node --trace-deprecation builds produce zero deprecation warnings (guide: "Make sure your build has no errors or warnings").
  • webpack.validate() confirms webpack.config.base.js (new output.library object form) and the generated configs pass webpack 5 schema validation.
  • E2E'd an image import through the new asset/resource rule (emits a content-hashed asset), since no example currently imports images.
  • E2E'd the generator: created tsx and md decks via create-spectacle CLI and built both successfully with webpack 5.111.1 / webpack-cli 5 (markdown content inlines correctly; only benign bundle-size hints in production mode).
  • pnpm run --filter ./packages/create-spectacle test — 4/4 pass.
  • pnpm run --filter ./packages/spectacle test — 115/115 pass (18 suites).
  • Lint, prettier, and types:check all pass for the touched workspaces.

Checklist

  • I have included a changeset if this change will require a version change to one of the packages.
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Applies the remaining steps from the official webpack 5 migration
guide (https://webpack.js.org/migrate/5/):

- output.library + output.libraryTarget -> output.library object
  (name/type) in webpack.config.base.js
- Replace deprecated file-loader and raw-loader rules with webpack 5
  built-in Asset Modules (asset/resource, asset/source)
- Upgrade webpack-cli 4 -> 5 (latest compatible with our
  webpack-dev-server 4 setup) and drop the raw-loader devDependency
- create-spectacle: generated webpack configs use Asset Modules and
  generated package.json drops file-loader, bumps webpack-cli to ^5
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
spectacle-docs-website Ready Ready Preview Sep 24, 2026 3:36pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dd1458f

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

This PR includes changesets to release 1 package
Name Type
create-spectacle Patch

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 branch was successfully deployed

1 active deployment
Preview — dd1458f0 Deployed Sep 24, 2026 by vercel[bot]
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