Skip to content

Fix/webpack#233

Closed
TrevorBurgoyne wants to merge 9 commits into
feature/image-filtersfrom
fix/webpack
Closed

Fix/webpack#233
TrevorBurgoyne wants to merge 9 commits into
feature/image-filtersfrom
fix/webpack

Conversation

@TrevorBurgoyne
Copy link
Copy Markdown
Member

@TrevorBurgoyne TrevorBurgoyne commented Oct 17, 2025

Improve build and update dependencies

Description

  • Closes webpack configuration and devDependencies usage #164
  • Removed redundant depencencies that were being unnecessarily installed by users using npm to install ulabel
  • 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)
  • Add test coverage for both minified and unminified builds
  • Update dependencies and fix 12 security vulnerabilities
Build File Before (v0.19.1) After (v0.20.0) Change Notes
ulabel.js (unminified) 1.04 MB 2.32 MB +1.28 MB (+123%) Now includes webpack runtime overhead and is human-readable for debugging
ulabel.min.js (minified) 1.04 MB 1.01 MB -0.03 MB (-3%) Properly minified with TerserPlugin

PR Checklist

  • Merged latest main
  • Version number in package.json has been bumped since last release
  • Version numbers match between package package.json and src/version.js
  • Ran npm install and npm run build AFTER bumping the version number
  • Updated documentation if necessary (currently just in api_spec.md)
  • Added changes to changelog.md

Breaking API Changes

ulabel.js is now unminified. If users were importing that file directly, and want to instead use the productionized and minified version, they should switch to ulabel.min.js

@TrevorBurgoyne TrevorBurgoyne added the dependencies Pull requests that update a dependency file label Oct 17, 2025
@TrevorBurgoyne TrevorBurgoyne mentioned this pull request Oct 17, 2025
6 tasks
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.js while keeping ulabel.js unminified
  • 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

Comment thread webpack.config.js Outdated
Comment thread CHANGELOG.md Outdated
@TrevorBurgoyne TrevorBurgoyne linked an issue Oct 17, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@joshua-dean joshua-dean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix 👍

Comment thread CHANGELOG.md
Comment on lines +23 to +24
- 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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@TrevorBurgoyne TrevorBurgoyne mentioned this pull request Oct 27, 2025
@TrevorBurgoyne TrevorBurgoyne deleted the fix/webpack branch October 27, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webpack configuration and devDependencies usage

3 participants