diff --git a/packages/theme/src/cli/utilities/theme-environment/local-assets.ts b/packages/theme/src/cli/utilities/theme-environment/local-assets.ts index 2c3f676fdc..907b922ea8 100644 --- a/packages/theme/src/cli/utilities/theme-environment/local-assets.ts +++ b/packages/theme/src/cli/utilities/theme-environment/local-assets.ts @@ -2,6 +2,7 @@ import {injectCdnProxy} from './proxy.js' import {parseServerEvent} from './server-utils.js' import {getLiquidTagContent} from './liquid-tag-content.js' import {lookupMimeType} from '@shopify/cli-kit/node/mimes' +import {Buffer} from 'node:buffer' import {defineEventHandler, H3Event, serveStatic, setResponseHeader, sendError, createError} from 'h3' import {joinPath} from '@shopify/cli-kit/node/path' import type {Theme, ThemeAsset, VirtualFileSystem} from '@shopify/cli-kit/node/themes/types' @@ -130,7 +131,7 @@ function handleStylesCss(ctx: DevServerContext, event: H3Event) { return serveStatic(event, { getContents: () => stylesheet, - getMeta: () => ({type: 'text/css', size: stylesheet.length, mtime: new Date()}), + getMeta: () => ({type: 'text/css', size: Buffer.byteLength(stylesheet), mtime: new Date()}), }) } @@ -190,7 +191,7 @@ function handleBlockScriptsJs(ctx: DevServerContext, event: H3Event, kind: 'bloc return serveStatic(event, { getContents: () => javascript, - getMeta: () => ({type: 'text/javascript', size: javascript.length, mtime: new Date()}), + getMeta: () => ({type: 'text/javascript', size: Buffer.byteLength(javascript), mtime: new Date()}), }) }