From d4e0576e2d350c07aef89aac8a4851e4c173b901 Mon Sep 17 00:00:00 2001 From: Shai Reznik Date: Sun, 12 Nov 2023 23:20:42 +0200 Subject: [PATCH] fix: 3rd party imports of libs during build --- .../qwik-city-middleware-request-handler/index.md | 2 +- packages/qwik/src/optimizer/src/plugins/plugin.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/docs/src/routes/api/qwik-city-middleware-request-handler/index.md b/packages/docs/src/routes/api/qwik-city-middleware-request-handler/index.md index 4629b930bee..f7638d9a9f9 100644 --- a/packages/docs/src/routes/api/qwik-city-middleware-request-handler/index.md +++ b/packages/docs/src/routes/api/qwik-city-middleware-request-handler/index.md @@ -261,7 +261,7 @@ export interface RequestEventBase | Property | Modifiers | Type | Description | | ----------------- | --------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [basePathname](#) | readonly | string | The base pathname of the request, which can be configured at build time. Defaults to /. | -| [cacheControl](#) | readonly | (cacheControl: [CacheControl](#cachecontrol), target?: CacheControlTarget) => void |

Convenience method to set the Cache-Control header. Depending on your CDN, you may want to add another cacheControl with the second argument set to CDN-Cache-Control or any other value (we provide the most common values for auto-complete, but you can use any string you want).

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control and https://qwik.builder.io/docs/caching/#CDN-Cache-Controls for more information.

| +| [cacheControl](#) | readonly | (cacheControl: [CacheControl](#cachecontrol), target?: CacheControlTarget) => void |

Convenience method to set the Cache-Control header. Depending on your CDN, you may want to add another cacheControl with the second argument set to CDN-Cache-Control or any other value (we provide the most common values for auto-complete, but you can use any string you want).

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control and https://qwik.builder.io/docs/caching/\#CDN-Cache-Controls for more information.

| | [clientConn](#) | readonly | [ClientConn](#clientconn) | Provides information about the client connection, such as the IP address and the country the request originated from. | | [cookie](#) | readonly | [Cookie](#cookie) |

HTTP request and response cookie. Use the get() method to retrieve a request cookie value. Use the set() method to set a response cookie value.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies

| | [env](#) | readonly | [EnvGetter](#envgetter) | Platform provided environment variables. | diff --git a/packages/qwik/src/optimizer/src/plugins/plugin.ts b/packages/qwik/src/optimizer/src/plugins/plugin.ts index bfa48a6ce22..9f09e6b216c 100644 --- a/packages/qwik/src/optimizer/src/plugins/plugin.ts +++ b/packages/qwik/src/optimizer/src/plugins/plugin.ts @@ -1,5 +1,7 @@ -import { createOptimizer } from '../optimizer'; +import type { Rollup } from 'vite'; +import { hashCode } from '../../../core/util/hash_code'; import { generateManifestFromBundles, getValidManifest } from '../manifest'; +import { createOptimizer } from '../optimizer'; import type { Diagnostic, EntryStrategy, @@ -17,8 +19,6 @@ import type { TransformOutput, } from '../types'; import { createLinter, type QwikLinter } from './eslint-plugin'; -import type { Rollup } from 'vite'; -import { hashCode } from '../../../core/util/hash_code'; const REG_CTX_NAME = ['server']; @@ -445,10 +445,10 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) { const transformedOutput = isSSR ? ssrTransformedOutputs.get(importer) : transformedOutputs.get(importer); - const p = transformedOutput?.[0].origPath; - if (p) { + const originalPath = transformedOutput?.[0].origPath || transformedOutput?.[1]; + if (originalPath) { // Resolve imports relative to original source path - return ctx.resolve(id, p, { skipSelf: true }); + return ctx.resolve(id, originalPath, { skipSelf: true }); } return; }