add platforms option
platform stuff is still mostly special cased but
This commit is contained in:
parent
b0356988fe
commit
12ace068f2
10
index.mjs
10
index.mjs
|
@ -5,12 +5,17 @@ import {resolve, basename, extname, dirname, relative, join} from 'node:path';
|
||||||
|
|
||||||
export function buildConfig ({
|
export function buildConfig ({
|
||||||
manifest: manifestPathRelative,
|
manifest: manifestPathRelative,
|
||||||
|
platforms = [],
|
||||||
scriptPlugins = [],
|
scriptPlugins = [],
|
||||||
sourcemap,
|
sourcemap,
|
||||||
}) {
|
}) {
|
||||||
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 {
|
||||||
|
@ -110,8 +115,7 @@ export function buildConfig ({
|
||||||
|
|
||||||
const {scripts, styles, assets} = getEntryPointsFromManifest(manifestContent);
|
const {scripts, styles, assets} = getEntryPointsFromManifest(manifestContent);
|
||||||
|
|
||||||
const platform = 'firefox';
|
return platforms.flatMap(platform => [
|
||||||
return [
|
|
||||||
...scripts.map(entrypointPath => ({
|
...scripts.map(entrypointPath => ({
|
||||||
input: relative(process.cwd(), entrypointPath),
|
input: relative(process.cwd(), entrypointPath),
|
||||||
output: {
|
output: {
|
||||||
|
@ -165,5 +169,5 @@ export function buildConfig ({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue