Replace Bower with npm/webpack across dev, prod, and unit tests#1116
Merged
Conversation
Add npm equivalents (or git-tag pins) for all 29 bower.json dependencies, ahead of replacing Bower/wiredep with webpack. Vendor ng-breadcrumbs directly since it was never published to npm and its repo has no package.json. Drop navigator-sendbeacon entirely: its polyfill only patches navigator.sendBeacon when the browser lacks a native implementation, and every supported browser has provided one natively since 2015-2016, so that branch never runs.
Adds `webpack.config.js` and a new entry point that requires all service files (auto-discovered via `require.context`, since dev and prod previously used two different manual orderings and both worked - modules just need to load before directives/services, which they now do explicitly). Also fixes two pre-existing bugs this surfaced: `rich-content-directive.js` called `app.directive(...)` instead of `module.directive(...)`, which only "worked" before because angular-timer leaked a global `app` variable by accident; and `angular-chosen-localytics` needs `chosen-js` loaded separately as its own package, which wasn't happening. `index-dev.html` now loads one bundled script instead of ~68 individual tags. CSS, `tincanjs`, and `pdf.js-viewer` remain on the old Bower-served paths for now.
Extracts CSS to a real file (mini-css-extract-plugin) instead of style-loader's runtime injection, since the latter landed after compair.less in the DOM and broke the app's font-family overrides. Also adds humanize-duration and window.jQuery to webpack-entry.js/ProvidePlugin - both were still missing pieces the old Bower setup supplied as separate globals, only surfacing once those features (timer countdown, angular.element) were actually exercised.
`ng-file-saver` reads `window.saveAs` directly instead of `require()`'ing `file-saver` itself, and `npm` had resolved the wrong version (1.3.8 vs the 2.0.4 Bower actually used) since `ng-file-saver`'s `package.json` and `bower.json` disagree on the range. Pins `file-saver@2.0.4` and requires it explicitly - same category as the `chosen-js/humanize-duration` fixes, a Bower-transitive companion script that needed a global. Verified via the classlist "Export Users" button: a real CSV now downloads instead of throwing "saveAs is not supported"
Contributor
Greptile SummaryThis PR replaces the old Bower frontend pipeline with npm and webpack. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "Document webpack step in the production ..." | Re-trigger Greptile |
Contributor
Author
Contributor
Author
Contributor
Author
|
Updated:
|
ionparticle
approved these changes
Jul 7, 2026
ionparticle
left a comment
Member
There was a problem hiding this comment.
Great work, bower was deeply integrated, so I'm sure this was complicated. This is very much appreciated.
I verify the prod build is loading as expected after the fix, so merge approved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace Bower with
npm/webpackacross the entire frontend build pipeline (dev bundling, prod bundling, and unit tests) and deletebower.json/bower_components.<script>/<link>tag injection to webpack (webpack-entry.js/webpack.config.js), invoked vianpm run build:dev.tincan.jsandpdf.js-viewerstay outside the webpack bundle (see code comments for why) and are copied fromnode_modulesvia gulp instead.gulpfile.js's existingconcat/uglify/revpipeline is unchanged in mechanism, just repointed frombower_components/tonode_modules/, using each package's actual browser-ready file rather than its"main"field (several packages'"main"is a CommonJS-only wrapper that throws when concatenated raw).karma.conf.jsmoved offwiredep/bower.jsonontokarma-webpack, reusing the same webpack config as dev mode via a newkarma-entry.jsthat auto-discovers spec files withrequire.context. No spec files neededrequire()calls added, except for the 9beforeEach(module(...))calls changed toangular.mock.module(...), since webpack's ownmodulebinding shadows angular-mocks' global helper of the same name.bower.jsondeleted,Dockerfile/.gitignore/gulpfile.jscleaned of now-dead references,bower/gulp-bower/wiredep/main-bower-filesuninstalled.