✘ [ERROR] Plugin "vike-esbuild" returned a path in the "file" namespace that is not an absolute path:
brillout opened this issue · 9 comments
Description
From PM:
it seems like vike-esbuild can't transpile the imports, which in our ESM monorepo setup point to a file in the framework (taproot) workspace:
14:25:59 [vike][config] Failed to transpile /src/renderer/+passToClient.js because:
✘ [ERROR] Plugin "vike-esbuild" returned a path in the "file" namespace that is not an absolute path: @ecosia/taproot/renderer/server/passToClient.jsalso tried to change +passToClient.js into +config.js and export { passToClient: […] } config object; no luck, the import is still not processed.
@LostCrew Active the debug logs with DEBUG=vike:pointer-imports npm run ...
and report back the logs.
Setup: yarn v1 with workspaces (yes, we are aware that, at this point, any other more modern package manager is better 😢), ESM, Node v20.2.x.
Output:
11:31:54 [vike][config] Failed to transpile /src/renderer/+passToClient.js because:
✘ [ERROR] Could not resolve "redacted_path_to_framework/renderer/server/passToClient.js" [plugin vike-esbuild]
src/renderer/+passToClient.js:1:25:
1 │ ...assToClient from 'redacted_path_to_framework/renderer/server/passToClient.js';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Also:
11:31:54 [vike][Warning] Update to the new V1 design to get rid of Vite's warning: The glob option "as" has been deprecated in favour of "query". See https://vike.dev/migration/v1-design for how to migrate.
The glob option "as" has been deprecated in favour of "query". Please update `as: 'extractExportNames'` to `query: '?extractExportNames'`.
From yarn.lock
, package versions that might be useful to know:
vite@5.4.6
vite-node@2.1.1
esbuild@^0.21.3 -> version "0.21.5"
esbuild@0.17.19 -> version "0.17.19"
,"esbuild@^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0": -> version "0.23.1"
Error does not occur for imports in other Vike-handled files (+onRenderHtml.js
, +onRenderClient.js
).
Exporting hardcoded values, thereby renouncing to importing them from a common place and repeating it on all Vike-powered apps, successfully circumvent the issue but it is very not ideal in terms of duplicated mantainance points.
Perhaps a non-deterministic incompatible version of ESBuild is used? In that case, we could try lock the esbuild version to a compatible one as resolution
in root package.json.
Thanks for advising 👍🏻
Your last output is a different error than the error I quoted in my original post, and it seems unrelated to Vike.
Also, the debug logs (DEBUG=vike:pointer-imports
) are missing. You should get logs like the following:
vike:pointer-imports code, no transformImports() (/renderer/+config.ts)
vike:pointer-imports transpile /pages/star-wars/@id/+dataIsomorph.ts
vike:pointer-imports code, post esbuild (/pages/star-wars/@id/+dataIsomorph.ts)
The best would be that you reproduce the original error and share the debug logs.
True, the state of the imports when running the above command was transitional and I thought the flag was set for the session, but wasn't.
Here is the output of yarn dev
ran with the flag set and the import pointing to an existing file from the yarn workspace of the framework that encapsulate Vike (once again, real framework npm package name redacted to @ecosia/framework
for privacy and security):
vike:pointer-imports transpile /src/renderer/+passToClient.js
vike:pointer-imports onResolved()
{
"args": {
"path": "@ecosia/framework/renderer/server/passToClient",
"importer": "/Users/emanuele/Code/core/search/settings/src/renderer/+passToClient.js",
"namespace": "file",
"resolveDir": "/Users/emanuele/Code/core/search/settings/src/renderer",
"kind": "import-statement",
"with": {}
},
"resolved": {
"errors": [],
"warnings": [],
"path": "/Users/emanuele/Code/core/framework/renderer/server/passToClient.js",
"external": false,
"sideEffects": true,
"namespace": "file",
"suffix": ""
},
"importPathTranspiled": "@ecosia/framework/renderer/server/passToClient",
"isPointerImport": false,
"isExternal": false
}
09:39:36 [vike][config] Failed to transpile /src/renderer/+passToClient.js because:
✘ [ERROR] Plugin "vike-esbuild" returned a path in the "file" namespace that is not an absolute path: @ecosia/framework/renderer/server/passToClient
src/renderer/+passToClient.js:1:25:
1 │ ...t passToClient from '@ecosia/framework/renderer/server/passToClient';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ecosia/framework
for privacy and security
Can you PM me the real one? This may very well be the issue.
@ecosia/framework
for privacy and securityCan you PM me the real one? This may very well be the issue.
Or, alternatively, publish a reproduction.
You now have a new PM
Can you try vike@0.4.195-commit-c68b18f
? I believe that should fix it.
Fix released in 0.4.196
.