-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Astro fails to output a hoisted .js file in dist #7146
Comments
The same is happening to me, even though I fixed all astro-related package versions. Luckily I was able to rollback to the last previously-working live version of the website that was built on the 8th of May. So the bug must have been introduced after that date. I attempted to find a regression version, but I failed so far. This is what I tried: I had everything fixed down to astro@2.2.3 and other related packages too. So, I tried force-installing the packages used by astro@2.2.3/package.json. 2.2.3 Hoisted file still got skipped. I also tried force-installing vite to version 4.2.1 (down from version 4.3.8). |
Another note, I think the missing hoisted code is related to Stuff that should be loaded on 'client:visible' directive is also not working on my site, which makes me think that the required code is in that missing hoisted file. Hope this helps narrow things down. |
Reproductionon a working commit, bumping rollup via resolutions in my package.json: "resolutions": {
"rollup": "3.22.0"
} caused the same problem. I tried to bump every single package from my package-lock, and it seems that rollup breaks it. Temporary fixWith rollup 3.21.8, hoisted .js files are getting outputted So as a temporary fix, you can add: "resolutions": {
"rollup": "3.21.8"
} to your package.json and do pnpm/npm/yarn install. Intermediate causeVite has in it's dependencies: "rollup": "^3.21.0", which means, that 3.22.0 gets installed automatically for everyone because of vite. |
It seems it might be caused by this particular pull request in Rollup |
Thanks @srflp . Had to use "overrides" instead of "resolutions" for npm if anyone else is reading this. |
This seems to be fixed in 2.5.2, so closing 🙂 |
I have this issue in latest astro 4 which is using rollup version 4.9.2, astro 4.10 and astro/vercel integration 6.1.2 Failed to load resource: the server responded with a status of 404 () hoisted.j4pK5_uY.js:1 It didn't seem to affect anything until I tried adding a svelte component and now I also get It's a static import but I guess the dynamic part comes from the way Astro loads it because of the client:load directive? |
What version of
astro
are you using?2.5.0
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
pnpm
What operating system are you using?
Kubuntu 23.04
What browser are you using?
Firefox
Describe the Bug
Given a file
src/utils/test.ts
insrc
:When I try to import and use it in an
.astro
file like this:The resulting bundle contains a script which tries to import JS code from a nonexistent file, e.g
import"./hoisted.8cca6103.js"
, which effectively breaks many minified scripts across the website.This problem only occurs in the build output, not when running dev mode. I've provided a stackblitz link with an example configuration that results in a broken build.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-ksnujv?file=dist%2F_astro%2Fhoisted.97534249.js
Participation
The text was updated successfully, but these errors were encountered: