feat: migrate to RSPack - #2131
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates the build pipeline from legacy Grunt + webpack v1 tooling to rspack (bundling) and SWC (CJS compilation), updates integration tooling to modern webpack/rollup versions, and adjusts docs/CI accordingly.
Changes:
- Replace Grunt-based build steps with
swc(CJS) +rspack(UMD bundles) and add a new rspack validation test project in Vitest. - Rework
publish-to-awsinto a standalone Node script and update CI/scripts to use the new build. - Update integration tests/dependencies and documentation to reflect current branch/tooling expectations.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.js | Adds a new rspack Vitest project and relaxes statement coverage threshold slightly for SWC helpers. |
| tests/rspack/rspack.test.js | Adds build-output validation tests for rspack bundles, minification, banners, and basic runtime behavior. |
| tests/integration/webpack-test/src/handlebars-wildcard-import-test.js | Removes wildcard import integration test (no longer supported). |
| tests/integration/webpack-test/src/handlebars-wildcard-import-pre-4.2-test.js | Removes pre-4.2 wildcard import integration test. |
| tests/integration/webpack-test/src/handlebars-runtime-test.js | Switches runtime import to default import style. |
| tests/integration/webpack-test/src/handlebars-require-vs-import-test.js | Updates import usage to default import to match new interop behavior. |
| tests/integration/webpack-test/src/handlebars-default-import-pre-4.2-test.js | Removes pre-4.2 default import test. |
| tests/integration/webpack-test/package.json | Upgrades webpack + webpack-cli versions in integration fixture. |
| tests/integration/webpack-babel-test/src/handlebars-inline-precompile-test.js | Switches runtime import to default import style. |
| tests/integration/webpack-babel-test/package.json | Upgrades Babel/webpack-related dependencies in integration fixture. |
| tests/integration/rollup-test/package.json | Upgrades rollup and node-resolve plugin in integration fixture. |
| tasks/publish-to-aws.js | Converts AWS publish task from a Grunt task to a standalone Node script. |
| rspack.config.js | Introduces rspack configuration to produce UMD bundles (minified and unminified) with license banners. |
| package.json | Updates scripts/devDependencies for new build/test pipeline; removes Grunt build invocation from main scripts. |
| lib/precompiler.js | Adjusts Handlebars import to default import. |
| lib/handlebars.runtime.js | Copies runtime namespace into a plain object to allow VM monkey-patching. |
| Gruntfile.js | Removes build pipeline tasks, leaving Gruntfile as “legacy” loader for remaining tasks. |
| CONTRIBUTING.md | Updates contributor docs to new build/test/lint commands and branch targeting guidance. |
| .swcrc | Adds SWC config for CommonJS compilation and inline sourcemaps. |
| .github/workflows/ci.yml | Re-enables integration tests on Ubuntu and switches browser job build step to npm run build. |
| .github/PULL_REQUEST_TEMPLATE.md | Updates PR template branch targeting to master. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { execSync } from 'child_process'; | ||
|
|
There was a problem hiding this comment.
This test file mixes ESM import syntax with CommonJS globals like __dirname and require(...). Under Vitest/Vite the presence of import typically makes the file run as an ES module, where __dirname and require are undefined, causing the suite to fail to even load. Consider converting this file to the same CommonJS style used by the other test suites (no import of vitest, use require), or compute __dirname via import.meta.url and use createRequire for CommonJS imports.
| import { execSync } from 'child_process'; | |
| import { execSync } from 'child_process'; | |
| import { fileURLToPath } from 'url'; | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = path.dirname(__filename); |
There was a problem hiding this comment.
This is fine as-is. Vitest runs test files through its own transform pipeline (powered by Vite/esbuild), which injects CJS compat shims (__dirname, require) regardless of whether the file uses import syntax. The globals: true setting also auto-injects describe/it/expect without needing explicit imports.
The mix of import and __dirname/require() is standard practice in Vitest projects - it's not actually running as a raw Node ESM module. No change needed here.
|
@jaylinski ready for rereview! |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
@jaylinski second batch addressed |
|
@jaylinski ping?.. |
|
Took a look at the output, there are some differences in file-size: Analyzed it with GPT-5.3-Codex, which says this is expected because of tooling changes: High-level result
Size deltas (key outputs)
What changed in output shape
If you want, I can also produce a machine-readable report (JSON/Markdown table) listing all 27 changed files with per-file size and hash deltas. |
Summary
webpackv1 +grunt-babel+grunt-uglifywithrspack(builtin:swc-loader,SwcJsMinimizerRspackPlugin,BannerPlugin) and@swc/clifor CJS compilationgruntdependencies from the build pipeline;Gruntfileretained only for legacy metrics/version taskspublish-to-awstask as standalone Node.js script (no grunt dependency)correctness, and browser compatibility targeting
webpack-cli 6 / rollup 4.40)
Breaking changes
import Handlebars from 'handlebars'should be used (default import).This was always the semantically correct form, as the package only has a default export. The previous behavior was an
accidental side-effect of Babel's loose module compilation, which assigned
module.exports = exports.default.