diff --git a/index.mjs b/index.mjs index 1fcd9c4..92848e4 100644 --- a/index.mjs +++ b/index.mjs @@ -5,7 +5,6 @@ import {resolve, basename, extname, dirname, relative, join} from 'node:path'; export function buildConfig ({ manifest: manifestPathRelative, - platforms = [], outDir = 'build/[platform]', scriptPlugins = [], sourcemap, @@ -13,10 +12,6 @@ export function buildConfig ({ 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 { @@ -112,14 +107,11 @@ export function buildConfig ({ const {scripts, styles, assets} = getEntryPointsFromManifest(manifestContent); - return platforms.flatMap(platform => [ + return [ ...scripts.map(entrypointPath => ({ input: relative(process.cwd(), entrypointPath), output: { - file: join( - outDir.replace(/\[platform\]/g, platform), - getOutputFilename(entrypointPath, 'js'), - ), + file: join(outDir, getOutputFilename(entrypointPath, 'js')), format: 'iife', sourcemap, }, @@ -131,10 +123,7 @@ export function buildConfig ({ { input: manifestPathRelative, output: { - file: join( - outDir.replace(/\[platform\]/g, platform), - 'manifest.json' - ), + file: join(outDir, 'manifest.json'), }, plugins: [ { @@ -172,5 +161,5 @@ export function buildConfig ({ }, ], }, - ]); + ]; }