Skip to content

Commit fb715a9

Browse files
committed
add support for amd options
1 parent afafa6d commit fb715a9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ Options
229229
--compress Compress output using Terser
230230
--strict Enforce undefined global context and add "use strict"
231231
--name Specify name exposed in UMD and IIFE builds
232+
--amd.id ID for AMD module (default is anonymous)
233+
--amd.define Function to use in place of `define`
232234
--cwd Use an alternative working directory (default .)
233235
--sourcemap Generate source map (default true)
234236
--raw Show raw byte size (default false)

src/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,15 @@ function createConfig(options, entry, format, writeMeta) {
457457
outputAliases['.'] = './' + basename(options.output);
458458
}
459459

460+
let amd = {};
461+
if (options['amd.id']) {
462+
amd.id = options['amd.id'];
463+
}
464+
465+
if (options['amd.define']) {
466+
amd.define = options['amd.define'];
467+
}
468+
460469
const moduleAliases = options.alias
461470
? parseMappingArgumentAlias(options.alias)
462471
: [];
@@ -707,6 +716,7 @@ function createConfig(options, entry, format, writeMeta) {
707716
outputOptions: {
708717
paths: outputAliases,
709718
globals,
719+
amd,
710720
strict: options.strict === true,
711721
legacy: true,
712722
freeze: false,

0 commit comments

Comments
 (0)