-
-
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:assets
image service bundle regression
#9059
Comments
astro:assets
regressionastro:assets
image service bundle regression
❯ 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 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. |
Here's my output on the same branch:
|
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 |
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
This worked in <3.4.4, broken in >3.5.0
https://github.com/alexanderniebuhr/astro-bug-debug
The text was updated successfully, but these errors were encountered: