diff --git a/index.mjs b/index.mjs index 3475f63..e85a324 100644 --- a/index.mjs +++ b/index.mjs @@ -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 ({ }, ], }, - ]; + ]); }