Skip to content

Commit

Permalink
Fix manifest override too
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUltDev authored Jan 2, 2024
1 parent e76407b commit 8585565
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/build/src/utilities/build-manifest-async.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */

import { resolve } from 'node:path'
import { platform } from 'node:os'
import { pathToFileURL } from 'node:url'

import {
Config,
Expand All @@ -22,6 +24,8 @@ import { globby } from 'globby'

import { importFresh } from './import-fresh.js'

const isWindows = platform() === 'win32'

export async function buildManifestAsync(options: {
config: Config
minify: boolean
Expand Down Expand Up @@ -209,12 +213,15 @@ function createManifestNetworkAccess(
async function overrideManifestAsync(
manifest: Manifest
): Promise<Record<string, any>> {
const filePaths = await globby(constants.build.manifestConfigGlobPattern, {
let filePaths = await globby(constants.build.manifestConfigGlobPattern, {
absolute: true
})
if (filePaths.length === 0) {
return manifest
}
if (isWindows) {
filePaths = filePaths.map(p => pathToFileURL(p).href)
}
const { default: overrideManifest } = await importFresh(filePaths[0])
return overrideManifest(manifest)
}

0 comments on commit 8585565

Please sign in to comment.