diff --git a/plugins/css_bundler/src/bundler.ts b/plugins/css_bundler/src/bundler.ts index e9c5d37..22469ec 100644 --- a/plugins/css_bundler/src/bundler.ts +++ b/plugins/css_bundler/src/bundler.ts @@ -1,6 +1,6 @@ import { fromFileUrl, join } from '$std/path/mod.ts' import { builder } from './builder.ts' -import { cssImports, Logger } from './helpers.ts' +import { cssImports, Logger, uInt8ArrayConcat } from './helpers.ts' export async function bundleCss( sourceDir: string, @@ -24,7 +24,7 @@ export async function bundleCss( ) await Deno.writeFile( join(assetDir, pathname), - Uint8Array.of(...code, ...sourceMappingURL), + uInt8ArrayConcat(code, sourceMappingURL), ) await Deno.writeFile( diff --git a/plugins/css_bundler/src/helpers.ts b/plugins/css_bundler/src/helpers.ts index 070728a..9f55cda 100644 --- a/plugins/css_bundler/src/helpers.ts +++ b/plugins/css_bundler/src/helpers.ts @@ -26,3 +26,10 @@ export async function hashFile(file: ArrayBuffer): Promise { } export const cssImports: Map = new Map() + +export function uInt8ArrayConcat(a: Uint8Array, b: Uint8Array) { + const dest = new Uint8Array(a.length + b.length) + dest.set(a) + dest.set(b, a.length) + return dest +}