add platforms option

platform stuff is still mostly special cased but
This commit is contained in:
Erin 2023-07-28 04:55:46 -04:00
parent b0356988fe
commit 12ace068f2

View file

@ -5,12 +5,17 @@ import {resolve, basename, extname, dirname, relative, join} from 'node:path';
export function buildConfig ({
manifest: manifestPathRelative,
platforms = [],
scriptPlugins = [],
sourcemap,
}) {
const manifestPath = resolve(process.cwd(), manifestPathRelative);
const manifestDirname = dirname(manifestPath);
if (!platforms.length) {
throw new Error('No platforms specified');
}
// Load the manifest
let manifestContent;
try {
@ -110,8 +115,7 @@ export function buildConfig ({
const {scripts, styles, assets} = getEntryPointsFromManifest(manifestContent);
const platform = 'firefox';
return [
return platforms.flatMap(platform => [
...scripts.map(entrypointPath => ({
input: relative(process.cwd(), entrypointPath),
output: {
@ -165,5 +169,5 @@ export function buildConfig ({
},
],
},
];
]);
}