Simplify buildAMD usages

This commit is contained in:
Alexandru Dima 2021-11-12 14:39:56 +01:00
parent 0278fd481d
commit 6b2860b7b0
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
6 changed files with 25 additions and 17 deletions

View file

@ -212,7 +212,8 @@ exports.buildESM = buildESM;
* @param {{
* base: string;
* entryPoint: string;
* banner: string;
* amdModuleId: string;
* amdDependencies?: string[];
* }} options
*/
function buildOneAMD(type, options) {
@ -227,7 +228,7 @@ function buildOneAMD(type, options) {
},
globalName: 'moduleExports',
banner: {
js: `${bundledFileHeader}${options.banner}`
js: `${bundledFileHeader}define("${options.amdModuleId}",[${(options.amdDependencies || []).map(dep => (`"${dep}"`)).join(',')}],()=>{`
},
footer: {
js: 'return moduleExports;\n});'
@ -251,7 +252,8 @@ function buildOneAMD(type, options) {
* @param {{
* base: string;
* entryPoint: string;
* banner: string;
* amdModuleId: string;
* amdDependencies?: string[];
* }} options
*/
function buildAMD(options) {