Fix/webpack#233
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the webpack build process to properly generate both minified and unminified builds, moves runtime dependencies to devDependencies (since they're bundled), and adds comprehensive test coverage for both build variants. The changes address issue #164 by reducing unnecessary installation overhead for npm users and providing better debugging support.
Key Changes:
- Enabled TerserPlugin for proper minification of
ulabel.min.jswhile keepingulabel.jsunminified - Moved bundled dependencies (
@turf/turf,jquery,polygon-clipping,uuidv4) to devDependencies - Added test infrastructure to validate both minified and unminified builds across unit and e2e tests
Reviewed Changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.js | Configured TerserPlugin to minify only .min.js files and added license file copying plugin |
| package.json | Updated entry points to default to minified build, moved runtime deps to devDependencies, added test scripts for both builds |
| tests/testing-utils/build_loader.js | New utility to load correct build based on ULABEL_BUILD environment variable |
| tests/ulabel.test.js | Updated to use centralized build loader instead of hardcoded path |
| tests/annotation.test.js | Updated to use centralized build loader instead of hardcoded path |
| tests/e2e/fixtures.js | New Playwright fixture to route requests based on project name for testing minified builds |
| tests/e2e/basic-functionality.spec.js | Updated to use custom fixtures for build selection |
| playwright.config.js | Added -minified variants of browser projects to test minified build |
| README.md | Updated documentation with examples for using both minified and unminified builds |
| CHANGELOG.md | Documented build process improvements and dependency changes |
| .github/workflows/test.yml | Updated test descriptions to reflect testing of both builds |
| .github/tasks.md | Updated task tracking with completed implementation steps |
| - Updated webpack build process to properly provide both a minified (default) and unminified build (for better debugging) | ||
| - Added package `exports` field with options: `.` (minified), `./min` (minified), `./debug` (unminified) |
There was a problem hiding this comment.
This does have the downside of adding a massive diff to every PR. Not a huge deal, although I would lean on the side of having all of the builds done as a GH Action upon merging PRs into main (which would also automate away one step of the current PR checklist).
Improve build and update dependencies
Description
webpackconfiguration anddevDependenciesusage #164exportsfield with options:.(minified),./min(minified),./debug(unminified)PR Checklist
package.jsonhas been bumped since last releasepackage.jsonandsrc/version.jsnpm installandnpm run buildAFTER bumping the version numberapi_spec.md)changelog.mdBreaking API Changes
ulabel.jsis now unminified. If users were importing that file directly, and want to instead use the productionized and minified version, they should switch toulabel.min.js