🔧 chore: use utility function to build webpack config#187
Conversation
Deploying clipcc-preview with
|
| Latest commit: |
7af8f23
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://58de5e4b.clipcc-preview.pages.dev |
| Branch Preview URL: | https://feat-infra.clipcc-preview.pages.dev |
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a shared WebpackConfigBuilder utility (new packages/infra) and migrates multiple package-level webpack configs to a manifest-driven setup to reduce duplication and centralize defaults.
Changes:
- Add
packages/infrawith a manifest-based webpack configuration builder and initial unit tests/docs. - Refactor webpack configurations for vm/storage/render/paint/l10n/gui/block/audio to use
webpack.manifest.js+ the shared builder. - Update workspace scripts/dependencies/lockfile to build and use the new infra package.
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates lockfile for new/updated build dependencies. |
| packages/vm/webpack.manifest.js | Adds VM webpack manifest consumed by the shared builder. |
| packages/vm/webpack.config.js | Refactors VM webpack config to use WebpackConfigBuilder and the manifest. |
| packages/vm/package.json | Adjusts VM dependencies/peerDependencies (incl. sb1 converter bump). |
| packages/storage/webpack.manifest.js | Adds storage webpack manifest (incl. target/plugins). |
| packages/storage/webpack.config.js | Refactors storage webpack config to use shared builder and generate multiple targets. |
| packages/render/webpack.manifest.js | Adds render webpack manifest. |
| packages/render/webpack.config.js | Refactors render webpack config to use shared builder. |
| packages/paint/webpack.manifest.js | Adds paint webpack manifest (React/TS + asset rules). |
| packages/paint/webpack.config.js | Refactors paint webpack config to use shared builder. |
| packages/l10n/webpack.manifest.js | Adds l10n webpack manifest. |
| packages/l10n/webpack.config.js | Refactors l10n webpack config to use shared builder. |
| packages/infra/tsconfig.dts.json | Adds TS config to emit d.ts from JS for the infra package. |
| packages/infra/test/targets.test.js | Adds initial tests for infra builder behavior. |
| packages/infra/src/index.js | Implements WebpackConfigBuilder and manifest normalization/defaults. |
| packages/infra/package.json | Defines new workspace package clipcc-webpack-configuration. |
| packages/infra/README.md | Documents intended infra package usage/API. |
| packages/infra/LICENSE | Adds license for infra package. |
| packages/infra/.gitignore | Adds infra package ignore rules. |
| packages/infra/.gitattributes | Adds infra package attributes (LF normalization). |
| packages/infra/.editorconfig | Adds infra package editor configuration. |
| packages/gui/webpack.manifest.js | Adds GUI webpack manifest (plugins/rules/workspacePackages). |
| packages/gui/webpack.config.js | Refactors GUI webpack config to use shared builder + manifest. |
| packages/block/webpack.manifest.js | Adds block webpack manifest (devtool, TS + extra rules). |
| packages/block/webpack.config.js | Refactors block webpack config to use shared builder + manifest. |
| packages/block/eslint.config.mjs | Updates eslint config to include webpack.manifest.js. |
| packages/audio/webpack.manifest.js | Adds audio webpack manifest. |
| packages/audio/webpack.config.js | Refactors audio webpack config to use shared builder + manifest. |
| packages/audio/package.json | Updates audio main entry path to match new dist output structure. |
| package.json | Ensures infra build runs as part of build:full and adds an infra workspace script alias. |
| UPSTREAM | Records upstream reference for scratch-webpack-configuration. |
💡 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.
| shouldSplitChunks: manifest.shouldSplitChunks ?? false, | ||
| rules: (manifest.rules ?? []).map(rule => normalizeRule(rootPath, rule)), | ||
| alias: normalizeAlias(rootPath, manifest.alias ?? {}), | ||
| plugins: manifest.plugins ?? [], | ||
| snapshot: normalizeSnapshot(rootPath, manifest.snapshot) ?? {}, | ||
| target: manifest.target ?? 'web', | ||
| playground: manifest.playground ?? false, | ||
| workspacePackages: manifest.workspacePackages ?? [], | ||
| externals: manifest.externals ?? {} | ||
| }; |
There was a problem hiding this comment.
normalizeManifest() forces a default target: 'web', so get() will always emit a target field even when callers did not specify one. This contradicts the new unit test expectation for a "generic" config without a target, and can change webpack defaults/behavior. Consider leaving target undefined unless explicitly provided (or update the tests/docs to match the intended behavior).
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
|
Since we now use |
Depends #182
Description
This PR maintains a universal set of webpack configuration rules and exposes a config builder to enable other packages to rapidly construct webpack configuration files.
Proposed Changes
clipcc-infrapackage that used to infrastructure-related jobs, such as making webpack configuration.webpack.manifest.jsto support this.Test Coverage
See /packages/infra/tests
Additional Context
None