Skip to content
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:assets image service bundle regression #9059

Closed
alexanderniebuhr opened this issue Nov 10, 2023 · 3 comments · Fixed by #9087
Closed

astro:assets image service bundle regression #9059

alexanderniebuhr opened this issue Nov 10, 2023 · 3 comments · Fixed by #9087
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: assets Related to the Assets feature (scope)

Comments

@alexanderniebuhr
Copy link
Member

alexanderniebuhr commented Nov 10, 2023

git bisect start
# status: waiting for both good and bad commits
# bad: [1e97708cda779510d638abaefdb4abf707b697e3] fix: added onError functionality to spinner (#9048)
git bisect bad 1e97708cda779510d638abaefdb4abf707b697e3
# status: waiting for good commit(s), bad commit known
# good: [653ad939ce9f0ba12e2ce79a4cf9c154302b0bb9] [ci] release (#8989)
git bisect good 653ad939ce9f0ba12e2ce79a4cf9c154302b0bb9
# good: [4e63467d74e5b0b0eba1c80772e4daf64ff2b2d1] Remove empty changeset (#9030)
git bisect good 4e63467d74e5b0b0eba1c80772e4daf64ff2b2d1
# bad: [83c88706848521922ccd9cbdd914b653e47309db] [ci] release (#9021)
git bisect bad 83c88706848521922ccd9cbdd914b653e47309db
# bad: [3e1239e42b99bf069265393dc359bf967fc64902] Content Collection cache (experimental) (#8854)
git bisect bad 3e1239e42b99bf069265393dc359bf967fc64902
# good: [bd2d494c04ca48c6a496078b650e3c49bf243390] fix(config types): routingStrategy is optional (#9034)
git bisect good bd2d494c04ca48c6a496078b650e3c49bf243390
# good: [5b16619e4ad9bbbf7a1519899b7f5dd1b850562a] fix(i18n): names of the functions should match the RFC (#9035)
git bisect good 5b16619e4ad9bbbf7a1519899b7f5dd1b850562a
# first bad commit: [3e1239e42b99bf069265393dc359bf967fc64902] Content Collection cache (experimental) (#8854)

Starting from this commit, the image service is (seemingly) getting wrongly bundled into SSR code even though it's unused, using the following "userland" image config.
https://github.com/withastro/adapters/pull/58/files

  • the image service is (knowingly) incompatible with Cloudflare runtime,
  • but they only use it on prerendered pages, so it should only be there at build
  • so they set an empty endpoint (since that should be the only runtime code using the image service)

This worked in <3.4.4, broken in >3.5.0

https://github.com/alexanderniebuhr/astro-bug-debug

@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 10, 2023
@alexanderniebuhr alexanderniebuhr removed the needs triage Issue needs to be triaged label Nov 10, 2023
@alexanderniebuhr alexanderniebuhr added the feat: assets Related to the Assets feature (scope) label Nov 10, 2023
@alexanderniebuhr alexanderniebuhr changed the title astro:assets regression astro:assets image service bundle regression Nov 10, 2023
@alexanderniebuhr alexanderniebuhr added the - P3: minor bug An edge case that only affects very specific usage (priority) label Nov 10, 2023
@alexanderniebuhr
Copy link
Member Author

❯ pnpm -v
8.10.2
❯ pnpm astro info
Astro                    v3.5.2
Node                     v20.9.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   server
Adapter                  none
Integrations             @astrojs/cloudflare

Using this branch: https://github.com/alexanderniebuhr/astro-bug-debug/tree/debug
I do get the following output. Let's double check that the config is the same:

DEBUG: {
  service: { entrypoint: 'astro/assets/services/sharp', config: {} },
  domains: [],
  remotePatterns: [],
  endpoint: '@astrojs/cloudflare/image-endpoint'
}
❯ pnpm run build

> @astrojs/[email protected] build /Users/alexanderniebuhr/Developer/tmp/astro-buggy
> DEBUG=astro:* astro build

  astro:telemetry [notify] last notified on 1693597734156 +0ms
  astro:telemetry {
  astro:telemetry   context: {
  astro:telemetry     isGit: true,
  astro:telemetry     anonymousProjectId: 'f2333d332f79cbef3b8be4f5b00c9db0c87e545a0dad52cc69107ec96f575557',
  astro:telemetry     packageManager: 'pnpm',
  astro:telemetry     packageManagerVersion: '8.10.2',
  astro:telemetry     anonymousId: 'a97dd8301f2f9b9c2c867b0d6eee52ed2f50e205afc7c3949cb829cc13c6edbf',
  astro:telemetry     anonymousSessionId: '71a187940231c011872b3ebaf1614fc1b1e4118e28dc3adc035457414190da65'
  astro:telemetry   },
  astro:telemetry   meta: {
  astro:telemetry     nodeVersion: '20.9.0',
  astro:telemetry     viteVersion: '4.5.0',
  astro:telemetry     astroVersion: '3.5.2',
  astro:telemetry     systemPlatform: 'darwin',
  astro:telemetry     systemRelease: '23.2.0',
  astro:telemetry     systemArchitecture: 'arm64',
  astro:telemetry     cpuCount: 10,
  astro:telemetry     cpuModel: 'Apple M1 Max',
  astro:telemetry     cpuSpeed: 2400,
  astro:telemetry     memoryInMb: 65536,
  astro:telemetry     isDocker: false,
  astro:telemetry     isTTY: true,
  astro:telemetry     isWSL: false,
  astro:telemetry     isCI: false,
  astro:telemetry     ciName: null
  astro:telemetry   }
  astro:telemetry } +306ms
  astro:telemetry [
  astro:telemetry   {
  astro:telemetry     "eventName": "ASTRO_CLI_SESSION_STARTED",
  astro:telemetry     "payload": {
  astro:telemetry       "cliCommand": "build",
  astro:telemetry       "config": {
  astro:telemetry         "output": "server",
  astro:telemetry         "integrations": [
  astro:telemetry           "@astrojs/cloudflare"
  astro:telemetry         ],
  astro:telemetry         "build": {},
  astro:telemetry         "image": {},
  astro:telemetry         "markdown": {},
  astro:telemetry         "experimental": {},
  astro:telemetry         "legacy": {}
  astro:telemetry       }
  astro:telemetry     }
  astro:telemetry   }
  astro:telemetry ] +2ms
  astro:[object Object] build Initial setup... [] +0ms
DEBUG: {
  service: { entrypoint: 'astro/assets/services/sharp', config: {} },
  domains: [],
  remotePatterns: [],
  endpoint: '@astrojs/cloudflare/image-endpoint'
}
08:02:16 PM [astro] The currently selected adapter `@astrojs/cloudflare` is not compatible with the image service "Sharp".
08:02:16 PM [content] No content directory found. Skipping type generation.
08:02:16 PM [build] output target: server
08:02:16 PM [build] deploy adapter: @astrojs/cloudflare
08:02:16 PM [build] Collecting build info...
  astro:build ├── ✔ node_modules/.pnpm/@[email protected][email protected]/node_modules/@astrojs/cloudflare/dist/entrypoints/image-endpoint.js +0ms
  astro:build ├── ✔ src/pages/index.astro +0ms
  astro:[object Object] build All pages loaded   1699642936.3s [] +16ms
08:02:16 PM [build] Completed in 17ms.
08:02:16 PM [build] Building server entrypoints...
Generated an empty chunk: "pages/image-endpoint.js".
08:02:17 PM [build] Completed in 466ms.

 prerendering static routes 
▶ src/pages/index.astro
  astro:[object Object] build Generating: / [] +483ms
  └─ /index.html (+8ms)
Completed in 17ms.


 generating optimized images 
  ▶ /_astro/lighthouse.db119d5c_ozcs.webp (before: 868kB, after: 11kB) (+89ms) (1/9)
  ▶ /_astro/lighthouse.db119d5c_19yQLM.webp (before: 868kB, after: 39kB) (+89ms) (2/9)
  ▶ /_astro/lighthouse.db119d5c_1dlzyJ.avif (before: 868kB, after: 30kB) (+89ms) (3/9)
  ▶ /_astro/lighthouse.db119d5c_Zsi17L.jpg (before: 868kB, after: 238kB) (+89ms) (4/9)
  ▶ /_astro/lighthouse.db119d5c_ZTQX8g.webp (before: 868kB, after: 146kB) (+90ms) (5/9)
  ▶ /_astro/lighthouse.db119d5c_rXwcW.jpg (before: 868kB, after: 18kB) (+89ms) (6/9)
  ▶ /_astro/lighthouse.db119d5c_1B8NMh.jpg (before: 868kB, after: 64kB) (+93ms) (7/9)
  ▶ /_astro/lighthouse.db119d5c_2mvR94.avif (before: 868kB, after: 103kB) (+198ms) (8/9)
  ▶ /_astro/lighthouse.db119d5c_i52e1.avif (before: 868kB, after: 355kB) (+515ms) (9/9)
Completed in 517ms.


 finalizing server assets 

08:02:17 PM [build] Rearranging server assets...
  astro:[object Object] build Additional assets copied   1699642936.3s [] +528ms
✘ [ERROR] Could not resolve "util"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/constructor.js:6:21:
      6 │ const util = require('util');~~~~~~

  The package "util" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/constructor.js:7:23:
      7 │ const stream = require('stream');
        ╵                        ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/utility.js:6:19:
      6 │ const fs = require('fs');~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/utility.js:7:21:
      7 │ const path = require('path');
        ╵                      ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/utility.js:8:23:
      8 │ const events = require('events');~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] No loader is configured for ".node" files: node_modules/.pnpm/[email protected]/node_modules/sharp/build/Release/sharp-darwin-arm64v8.node

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/sharp.js:10:27:
      10 │   module.exports = require(`../build/Release/sharp-${platformAndArch}.node`);
         ╵                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/libvips.js:6:19:
      6 │ const fs = require('fs');
        ╵                    ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "os"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/libvips.js:7:19:
      7 │ const os = require('os');~~~~

  The package "os" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "child_process"

    node_modules/.pnpm/[email protected]/node_modules/detect-libc/lib/detect-libc.js:6:29:
      6 │ const childProcess = require('child_process');
        ╵                              ~~~~~~~~~~~~~~~

  The package "child_process" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/output.js:6:21:
      6 │ const path = require('path');~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/libvips.js:8:21:
      8 │ const path = require('path');
        ╵                      ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "child_process"

    node_modules/.pnpm/[email protected]/node_modules/sharp/lib/libvips.js:9:26:
      9 │ const spawnSync = require('child_process').spawnSync;~~~~~~~~~~~~~~~

  The package "child_process" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/detect-libc/lib/filesystem.js:6:19:
      6 │ const fs = require('fs');
        ╵                    ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

  astro:telemetry {
  astro:telemetry   context: {
  astro:telemetry     isGit: true,
  astro:telemetry     anonymousProjectId: 'f2333d332f79cbef3b8be4f5b00c9db0c87e545a0dad52cc69107ec96f575557',
  astro:telemetry     packageManager: 'pnpm',
  astro:telemetry     packageManagerVersion: '8.10.2',
  astro:telemetry     anonymousId: 'a97dd8301f2f9b9c2c867b0d6eee52ed2f50e205afc7c3949cb829cc13c6edbf',
  astro:telemetry     anonymousSessionId: '71a187940231c011872b3ebaf1614fc1b1e4118e28dc3adc035457414190da65'
  astro:telemetry   },
  astro:telemetry   meta: {
  astro:telemetry     nodeVersion: '20.9.0',
  astro:telemetry     viteVersion: '4.5.0',
  astro:telemetry     astroVersion: '3.5.2',
  astro:telemetry     systemPlatform: 'darwin',
  astro:telemetry     systemRelease: '23.2.0',
  astro:telemetry     systemArchitecture: 'arm64',
  astro:telemetry     cpuCount: 10,
  astro:telemetry     cpuModel: 'Apple M1 Max',
  astro:telemetry     cpuSpeed: 2400,
  astro:telemetry     memoryInMb: 65536,
  astro:telemetry     isDocker: false,
  astro:telemetry     isTTY: true,
  astro:telemetry     isWSL: false,
  astro:telemetry     isCI: false,
  astro:telemetry     ciName: null
  astro:telemetry   }
  astro:telemetry } +1s
  astro:telemetry [
  astro:telemetry   {
  astro:telemetry     "eventName": "ASTRO_CLI_ERROR",
  astro:telemetry     "payload": {
  astro:telemetry       "cliCommand": "build",
  astro:telemetry       "isFatal": true,
  astro:telemetry       "anonymousMessageHint": "Could not resolve"
  astro:telemetry     }
  astro:telemetry   }
  astro:telemetry ] +1ms
 error   Could not resolve "child_process"
  File:
    node_modules/.pnpm/[email protected]/node_modules/detect-libc/lib/detect-libc.js:6:29
  Code:
    > 6 | const childProcess = require('child_process');
        |                             ^
      7 | const { isLinux, getReport } = require('./process');
      8 | const { LDD_PATH, readFile, readFileSync } = require('./filesystem');
  Stacktrace:
Error: Build failed with 13 errors:
node_modules/.pnpm/[email protected]/node_modules/detect-libc/lib/detect-libc.js:6:29: ERROR: Could not resolve "child_process"
node_modules/.pnpm/[email protected]/node_modules/detect-libc/lib/filesystem.js:6:19: ERROR: Could not resolve "fs"
node_modules/.pnpm/[email protected]/node_modules/sharp/lib/constructor.js:6:21: ERROR: Could not resolve "util"
node_modules/.pnpm/[email protected]/node_modules/sharp/lib/constructor.js:7:23: ERROR: Could not resolve "stream"
node_modules/.pnpm/[email protected]/node_modules/sharp/lib/libvips.js:6:19: ERROR: Could not resolve "fs"
...
    at failureErrorWithLog (/Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1650:15)
    at /Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1059:25
    at /Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1004:52
    at buildResponseToResult (/Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1057:7)
    at /Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1086:16
    at responseCallbacks.<computed> (/Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:703:9)
    at handleIncomingPacket (/Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:763:9)
    at Socket.readFromStdout (/Users/alexanderniebuhr/Developer/tmp/astro-buggy/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:679:7)
    at Socket.emit (node:events:514:28)
    at addChunk (node:internal/streams/readable:376:12)

 ELIFECYCLE  Command failed with exit code 1.

@natemoo-re
Copy link
Member

Here's my output on the same branch:

pnpm version seems to be the only difference so far...

❯ pnpm -v
8.6.12
Astro                    v3.5.2
Node                     v20.9.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   server
Adapter                  none
Integrations             @astrojs/cloudflare
DEBUG: {
  service: { entrypoint: 'astro/assets/services/sharp', config: {} },
  domains: [],
  remotePatterns: [],
  endpoint: '@astrojs/cloudflare/image-endpoint'
}
❯ pnpm run build

> @astrojs/[email protected] build /Users/nmoo/Developer/withastro/repros/astro-bug-debug
> DEBUG=astro:* astro build

  astro:telemetry [notify] last notified on 1692988255430 +0ms
  astro:telemetry {
  astro:telemetry   context: {
  astro:telemetry     isGit: true,
  astro:telemetry     anonymousProjectId: 'f2333d332f79cbef3b8be4f5b00c9db0c87e545a0dad52cc69107ec96f575557',
  astro:telemetry     packageManager: 'pnpm',
  astro:telemetry     packageManagerVersion: '8.6.12',
  astro:telemetry     anonymousId: '84e1e3b3ca4aa1cbbd32a695a88c9ed60ebf98a437bb23fcde37577395a8d7fa',
  astro:telemetry     anonymousSessionId: '6999731e14ae7178e604ec7948457de9e8cdec00fde1888f7b3034766f9240b2'
  astro:telemetry   },
  astro:telemetry   meta: {
  astro:telemetry     nodeVersion: '20.9.0',
  astro:telemetry     viteVersion: '4.5.0',
  astro:telemetry     astroVersion: '3.5.2',
  astro:telemetry     systemPlatform: 'darwin',
  astro:telemetry     systemRelease: '23.0.0',
  astro:telemetry     systemArchitecture: 'arm64',
  astro:telemetry     cpuCount: 12,
  astro:telemetry     cpuModel: 'Apple M2 Pro',
  astro:telemetry     cpuSpeed: 2400,
  astro:telemetry     memoryInMb: 16384,
  astro:telemetry     isDocker: false,
  astro:telemetry     isTTY: true,
  astro:telemetry     isWSL: false,
  astro:telemetry     isCI: false,
  astro:telemetry     ciName: null
  astro:telemetry   }
  astro:telemetry } +551ms
  astro:telemetry [
  astro:telemetry   {
  astro:telemetry     "eventName": "ASTRO_CLI_SESSION_STARTED",
  astro:telemetry     "payload": {
  astro:telemetry       "cliCommand": "build",
  astro:telemetry       "config": {
  astro:telemetry         "output": "server",
  astro:telemetry         "integrations": [
  astro:telemetry           "@astrojs/cloudflare"
  astro:telemetry         ],
  astro:telemetry         "build": {},
  astro:telemetry         "image": {},
  astro:telemetry         "markdown": {},
  astro:telemetry         "experimental": {},
  astro:telemetry         "legacy": {}
  astro:telemetry       }
  astro:telemetry     }
  astro:telemetry   }
  astro:telemetry ] +2ms
  astro:[object Object] build Initial setup... [] +0ms
DEBUG: {
  service: { entrypoint: 'astro/assets/services/sharp', config: {} },
  domains: [],
  remotePatterns: [],
  endpoint: '@astrojs/cloudflare/image-endpoint'
}
01:16:12 PM [astro] The currently selected adapter `@astrojs/cloudflare` is not compatible with the image service "Sharp".
01:16:12 PM [content] No content directory found. Skipping type generation.
01:16:12 PM [build] output target: server
01:16:12 PM [build] deploy adapter: @astrojs/cloudflare
01:16:12 PM [build] Collecting build info...
  astro:build ├── ✔ node_modules/.pnpm/@[email protected][email protected]/node_modules/@astrojs/cloudflare/dist/entrypoints/image-endpoint.js +0ms
  astro:build ├── ✔ src/pages/index.astro +0ms
  astro:[object Object] build All pages loaded   1699643771.9s [] +29ms
01:16:12 PM [build] Completed in 29ms.
01:16:12 PM [build] Building server entrypoints...
Generated an empty chunk: "pages/image-endpoint.js".
01:16:13 PM [build] Completed in 565ms.

 prerendering static routes 
▶ src/pages/index.astro
  astro:[object Object] build Generating: / [] +586ms
  └─ /index.html (+11ms)
Completed in 22ms.


 generating optimized images 
  ▶ /_astro/lighthouse.db119d5c_1dlzyJ.avif (before: 868kB, after: 30kB) (+174ms) (1/9)
  ▶ /_astro/lighthouse.db119d5c_ZTQX8g.webp (before: 868kB, after: 146kB) (+174ms) (2/9)
  ▶ /_astro/lighthouse.db119d5c_ozcs.webp (before: 868kB, after: 11kB) (+174ms) (3/9)
  ▶ /_astro/lighthouse.db119d5c_rXwcW.jpg (before: 868kB, after: 18kB) (+174ms) (4/9)
  ▶ /_astro/lighthouse.db119d5c_19yQLM.webp (before: 868kB, after: 39kB) (+174ms) (5/9)
  ▶ /_astro/lighthouse.db119d5c_1B8NMh.jpg (before: 868kB, after: 64kB) (+174ms) (6/9)
  ▶ /_astro/lighthouse.db119d5c_Zsi17L.jpg (before: 868kB, after: 238kB) (+188ms) (7/9)
  ▶ /_astro/lighthouse.db119d5c_2mvR94.avif (before: 868kB, after: 103kB) (+224ms) (8/9)
  ▶ /_astro/lighthouse.db119d5c_i52e1.avif (before: 868kB, after: 355kB) (+691ms) (9/9)
Completed in 693ms.


 finalizing server assets 

01:16:14 PM [build] Rearranging server assets...
  astro:[object Object] build Additional assets copied   1699643771.9s [] +707ms
01:16:14 PM [build] Server built in 1.39s
01:16:14 PM [build] Complete!

@alexanderniebuhr
Copy link
Member Author

Found it out by accident (https://discord.com/channels/830184174198718474/845430950191038464/1173670300567744573)

It seems to be introduced by https://github.com/withastro/astro/pull/8854/files#diff-19249203b189275e9f5f9bb2f0bca3b57da43da973be3b8961b58dd818a1fbcc

Applying (reverting) the following patch, fixes the regression:

diff --git i/packages/astro/src/core/build/plugins/plugin-prerender.ts w/packages/astro/src/core/build/plugins/plugin-prerender.ts
index d3d5305e4..0584f15a6 100644
--- i/packages/astro/src/core/build/plugins/plugin-prerender.ts
+++ w/packages/astro/src/core/build/plugins/plugin-prerender.ts
@@ -12,7 +12,11 @@ function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals
 
                outputOptions(outputOptions) {
                        extendManualChunks(outputOptions, {
-                               before(id, meta) {
+                               after(id, meta) {
+                                       // Split the Astro runtime into a separate chunk for readability
+                                       if (id.includes('astro/dist/runtime')) {
+                                               return 'astro';
+                                       }
                                        const pageInfo = internals.pagesByViteID.get(id);
                                        if (pageInfo) {
                                                // prerendered pages should be split into their own chunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: assets Related to the Assets feature (scope)
Projects
None yet
2 participants