-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error [RollupError]: Could not resolve "../dist/assets.json" from "renderer/_default.page.server.ts" after upgrade 0.4.161 #1501
Comments
now assets.json exist, what's happens? |
I have same problem, but only if I install dependencies with production flag |
strange thing is that there are still references to const assetsJsonFilePath = path.posix.join(outDirs.outDirRoot, 'assets.json') const assetsJsonFilePath = path.join(dir, '..', 'assets.json') |
Let me try to reproduce. |
I cannot reproduce, can one of you publish a reproduction? |
The assets JSON should still be emitted at |
We will try to reproduce this error, but it is already clear that this does not always happen. That is, sometimes during a build temporary files are not deleted and the resulting file is not created |
I'll double check the source code for race conditions. I'll report back (ETA today or tomorrow). |
I don't see any potential race condition in here (the
Are there any thrown errors when this happens? |
|
Alright, I see what's going on: Rollup is trying to analyze @DaniilIsupov You can try this workaround: const manifestPath = '../dist/assets.json'
const manifest = await import(manifestPath) @nestle49 I've further enforced the |
Yes, still relevant with [email protected] and workaround isn't working, same error traced:
|
How about this: const manifestPath = '../dist/ass' + (1 + 1 < 3) && 'ets.json'
const manifest = await import(manifestPath) Rollup shouldn't be able to analyze that. |
This will only work if you upgrade build.target, otherwise I get an error:
But of course I wouldn’t want to use such code |
const rollupStaticAnalysisBuster = 1 + 1 < 10 ? '' : 'rollupStaticAnalysisBuster'
let manifest
export async funcion onRenderHtml() {
manifest = manifest ?? await import("../dist/client/assets.json" + rollupStaticAnalysisBuster)
} Also, I will make the assets manifest available over |
@brillout as temporary solution, I did it like this import { readFile } from 'fs/promises'
JSON.parse((await readFile(new URL('../../../dist/assets.json', import.meta.url))).toString()) I will wait to full fix this bug |
https://vike.dev/getGlobalContext released in |
Btw. we're looking for sponsors, in case that's something your company would consider. |
Description
I import manifest inside renderer/_default.page.server.ts:
const getManifest = import('../dist/assets.json').catch(() => ({ default: {} }))
After upgrade from 0.4.160 -> 0.4.161 (or higher) I discovered assets.json renamed client/_temp_manifest.json
After build error I looked at the changelog again https://github.com/vikejs/vike/blob/main/CHANGELOG.md, but didn't see this change or guid for migration
The text was updated successfully, but these errors were encountered: