From ee58f28b33aa652b29480eeb887acaa183ed21b5 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Tue, 21 Jan 2025 21:24:36 +0000 Subject: [PATCH] fix(vite-plugin-angular): fix component HMR with angular 19.1.2 (#1563) --- package.json | 2 +- .../src/lib/angular-vite-plugin.ts | 4 +-- pnpm-lock.yaml | 32 ++++++++++++------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index e2144ad09..bd136f384 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ "ng-packagr": "^19.0.0", "nitropack": "^2.10.0", "nx": "20.1.2", - "playwright": "^1.30.0", + "playwright": "^1.49.1", "postcss": "^8.4.21", "postcss-import": "~15.1.0", "postcss-preset-env": "~8.0.1", diff --git a/packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts b/packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts index a3b67f1c0..1fae4b253 100644 --- a/packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts +++ b/packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts @@ -265,7 +265,7 @@ export function angular(options?: PluginOptions): Plugin[] { return; } - if (!req.url.startsWith(ANGULAR_COMPONENT_PREFIX)) { + if (!req.url.includes(ANGULAR_COMPONENT_PREFIX)) { next(); return; @@ -489,7 +489,7 @@ export function angular(options?: PluginOptions): Plugin[] { if ( pluginOptions.liveReload && options?.ssr && - id.startsWith(ANGULAR_COMPONENT_PREFIX) + id.includes(ANGULAR_COMPONENT_PREFIX) ) { const requestUrl = new URL(id.slice(1), 'http://localhost'); const componentId = requestUrl.searchParams.get('c'); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89a0075dd..f1cf2919d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -331,8 +331,8 @@ importers: specifier: 20.1.2 version: 20.1.2(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.5.4))(@swc/core@1.5.7(@swc/helpers@0.5.11)) playwright: - specifier: ^1.30.0 - version: 1.30.0 + specifier: ^1.49.1 + version: 1.49.1 postcss: specifier: ^8.4.21 version: 8.4.38 @@ -7993,6 +7993,11 @@ packages: fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -11074,14 +11079,14 @@ packages: resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} engines: {node: '>=8'} - playwright-core@1.30.0: - resolution: {integrity: sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==} - engines: {node: '>=14'} + playwright-core@1.49.1: + resolution: {integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==} + engines: {node: '>=18'} hasBin: true - playwright@1.30.0: - resolution: {integrity: sha512-ENbW5o75HYB3YhnMTKJLTErIBExrSlX2ZZ1C/FzmHjUYIfxj/UnI+DWpQr992m+OQVSg0rCExAOlRwB+x+yyIg==} - engines: {node: '>=14'} + playwright@1.49.1: + resolution: {integrity: sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==} + engines: {node: '>=18'} hasBin: true pluralize@8.0.0: @@ -24652,6 +24657,9 @@ snapshots: fs.realpath@1.0.0: {} + fsevents@2.3.2: + optional: true + fsevents@2.3.3: optional: true @@ -28720,11 +28728,13 @@ snapshots: dependencies: find-up: 3.0.0 - playwright-core@1.30.0: {} + playwright-core@1.49.1: {} - playwright@1.30.0: + playwright@1.49.1: dependencies: - playwright-core: 1.30.0 + playwright-core: 1.49.1 + optionalDependencies: + fsevents: 2.3.2 pluralize@8.0.0: {}