add outDir option
This commit is contained in:
parent
12ace068f2
commit
95519137f5
15
index.mjs
15
index.mjs
|
@ -6,6 +6,7 @@ import {resolve, basename, extname, dirname, relative, join} from 'node:path';
|
|||
export function buildConfig ({
|
||||
manifest: manifestPathRelative,
|
||||
platforms = [],
|
||||
outDir = 'build/[platform]',
|
||||
scriptPlugins = [],
|
||||
sourcemap,
|
||||
}) {
|
||||
|
@ -51,10 +52,6 @@ export function buildConfig ({
|
|||
return join(base, uniqueFileNameSegment(entryPath, ext));
|
||||
}
|
||||
|
||||
function getOutputPathRelative (outputDir, platform, entryPath, ext) {
|
||||
return join(outputDir, platform, getOutputFilename(entryPath, ext));
|
||||
}
|
||||
|
||||
/** Scans a manifest for entrypoints */
|
||||
function getEntryPointsFromManifest (manifestContent) {
|
||||
const scriptEntrypointAbsolutePaths = [];
|
||||
|
@ -119,7 +116,10 @@ export function buildConfig ({
|
|||
...scripts.map(entrypointPath => ({
|
||||
input: relative(process.cwd(), entrypointPath),
|
||||
output: {
|
||||
file: getOutputPathRelative('build', platform, entrypointPath, 'js'),
|
||||
file: join(
|
||||
outDir.replace(/\[platform\]/g, platform),
|
||||
getOutputFilename(entrypointPath, 'js'),
|
||||
),
|
||||
format: 'iife',
|
||||
sourcemap,
|
||||
},
|
||||
|
@ -131,7 +131,10 @@ export function buildConfig ({
|
|||
{
|
||||
input: manifestPathRelative,
|
||||
output: {
|
||||
file: `build/${platform}/manifest.json`,
|
||||
file: join(
|
||||
outDir.replace(/\[platform\]/g, platform),
|
||||
`manifest.json`
|
||||
),
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue