refactor to use single options object
This commit is contained in:
parent
da9edb17b7
commit
8bc53613b0
12
index.mjs
12
index.mjs
|
@ -3,7 +3,11 @@
|
|||
import {readFileSync} from 'node:fs';
|
||||
import {resolve, basename, extname, dirname, relative, join} from 'node:path';
|
||||
|
||||
export function createConfig (manifestPathRelative, options, createConfig) {
|
||||
export function createConfig ({
|
||||
manifest: manifestPathRelative,
|
||||
scriptPlugins = [],
|
||||
sourcemap,
|
||||
}) {
|
||||
const manifestPath = resolve(process.cwd(), manifestPathRelative);
|
||||
const manifestDirname = dirname(manifestPath);
|
||||
|
||||
|
@ -109,15 +113,13 @@ export function createConfig (manifestPathRelative, options, createConfig) {
|
|||
const platform = 'firefox';
|
||||
return [
|
||||
...scripts.map(entrypointPath => ({
|
||||
// Get configuration options for this entrypoint from the caller
|
||||
...createConfig(),
|
||||
// Overwrite input and output options
|
||||
input: relative(process.cwd(), entrypointPath),
|
||||
output: {
|
||||
file: getOutputPathRelative('build', platform, entrypointPath, 'js'),
|
||||
format: 'iife',
|
||||
sourcemap: options.sourcemap,
|
||||
sourcemap,
|
||||
},
|
||||
plugins: scriptPlugins,
|
||||
})),
|
||||
|
||||
// A special step that processes the manifest and copies over non-JS
|
||||
|
|
Loading…
Reference in a new issue