You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by gi...@apache.org on 2026/06/07 05:56:03 UTC
(texera) branch main updated: fix(frontend): use default import for package.json version in dev build (#5444)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new ce91924351 fix(frontend): use default import for package.json version in dev build (#5444)
ce91924351 is described below
commit ce919243517c2e0654979ac5b4cdcc8e7f89afe4
Author: Matthew B. <mg...@uci.edu>
AuthorDate: Sat Jun 6 22:45:37 2026 -0700
fix(frontend): use default import for package.json version in dev build (#5444)
### What changes were proposed in this PR?
- Change `frontend/src/environments/version.ts` to import `package.json`
with a default import (`packageJson.version`) instead of a named import
(`import { version }`).
- Why it is a bug: Angular 21's webpack rejects named imports from JSON
modules, so `ng serve` (dev) fails to compile and the dev server serves
"Cannot GET /" (HTTP 404). Production builds are unaffected because
`angular.json` fileReplacements swaps in `version.prod.ts`.
### Any related issues, documentation, discussions?
Closes #5443 (regression introduced by #5153).
### How was this PR tested?
- From `frontend/` on Node >=24, run `yarn start` and confirm the dev
server compiles with no errors (previously failed on `version.ts` with
`Failed to compile.`).
- Open http://localhost:4200/ and confirm the app loads (HTTP 200, page
title "Texera") instead of "Cannot GET /".
- Confirm the UI footer still shows the version string from
`package.json`.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)
---
.../src/environments/{version.ts => version.spec.ts} | 19 ++++++++++++-------
frontend/src/environments/version.ts | 5 +++--
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/frontend/src/environments/version.ts b/frontend/src/environments/version.spec.ts
similarity index 66%
copy from frontend/src/environments/version.ts
copy to frontend/src/environments/version.spec.ts
index 34748af22b..4416ff4fb5 100644
--- a/frontend/src/environments/version.ts
+++ b/frontend/src/environments/version.spec.ts
@@ -17,11 +17,16 @@
* under the License.
*/
-import { version } from "../../package.json";
+import packageJson from "../../package.json";
+import { Version } from "./version";
-// Dev placeholder. Production builds replace this file with the generated
-// version.prod.ts (see angular.json fileReplacements + frontend/build-version.js).
-export const Version = {
- buildNumber: "dev",
- version,
-};
+describe("Version (dev environment)", () => {
+ it("exposes the version from package.json", () => {
+ expect(Version.version).toBe(packageJson.version);
+ expect(Version.version.length).toBeGreaterThan(0);
+ });
+
+ it('uses the "dev" build number placeholder', () => {
+ expect(Version.buildNumber).toBe("dev");
+ });
+});
diff --git a/frontend/src/environments/version.ts b/frontend/src/environments/version.ts
index 34748af22b..901d9accc8 100644
--- a/frontend/src/environments/version.ts
+++ b/frontend/src/environments/version.ts
@@ -17,11 +17,12 @@
* under the License.
*/
-import { version } from "../../package.json";
+// Default import: Angular's webpack rejects named JSON imports.
+import packageJson from "../../package.json";
// Dev placeholder. Production builds replace this file with the generated
// version.prod.ts (see angular.json fileReplacements + frontend/build-version.js).
export const Version = {
buildNumber: "dev",
- version,
+ version: packageJson.version,
};