actually theres no reason to include platforms

This commit is contained in:
Erin 2023-07-28 05:18:49 -04:00
parent 01ad1423b2
commit 03be5326ce

View file

@ -5,7 +5,6 @@ import {resolve, basename, extname, dirname, relative, join} from 'node:path';
export function buildConfig ({ export function buildConfig ({
manifest: manifestPathRelative, manifest: manifestPathRelative,
platforms = [],
outDir = 'build/[platform]', outDir = 'build/[platform]',
scriptPlugins = [], scriptPlugins = [],
sourcemap, sourcemap,
@ -13,10 +12,6 @@ export function buildConfig ({
const manifestPath = resolve(process.cwd(), manifestPathRelative); const manifestPath = resolve(process.cwd(), manifestPathRelative);
const manifestDirname = dirname(manifestPath); const manifestDirname = dirname(manifestPath);
if (!platforms.length) {
throw new Error('No platforms specified');
}
// Load the manifest // Load the manifest
let manifestContent; let manifestContent;
try { try {
@ -112,14 +107,11 @@ export function buildConfig ({
const {scripts, styles, assets} = getEntryPointsFromManifest(manifestContent); const {scripts, styles, assets} = getEntryPointsFromManifest(manifestContent);
return platforms.flatMap(platform => [ return [
...scripts.map(entrypointPath => ({ ...scripts.map(entrypointPath => ({
input: relative(process.cwd(), entrypointPath), input: relative(process.cwd(), entrypointPath),
output: { output: {
file: join( file: join(outDir, getOutputFilename(entrypointPath, 'js')),
outDir.replace(/\[platform\]/g, platform),
getOutputFilename(entrypointPath, 'js'),
),
format: 'iife', format: 'iife',
sourcemap, sourcemap,
}, },
@ -131,10 +123,7 @@ export function buildConfig ({
{ {
input: manifestPathRelative, input: manifestPathRelative,
output: { output: {
file: join( file: join(outDir, 'manifest.json'),
outDir.replace(/\[platform\]/g, platform),
'manifest.json'
),
}, },
plugins: [ plugins: [
{ {
@ -172,5 +161,5 @@ export function buildConfig ({
}, },
], ],
}, },
]); ];
} }