Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ Options
--compress Compress output using Terser
--strict Enforce undefined global context and add "use strict"
--name Specify name exposed in UMD and IIFE builds
--amd.id ID for AMD module (default is anonymous)
--amd.define Function to use in place of `define`
--cwd Use an alternative working directory (default .)
--sourcemap Generate source map (default true)
--raw Show raw byte size (default false)
Expand Down
10 changes: 10 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,15 @@ function createConfig(options, entry, format, writeMeta) {
outputAliases['.'] = './' + basename(options.output);
}

let amd = {};
if (options['amd.id']) {
amd.id = options['amd.id'];
}

if (options['amd.define']) {
amd.define = options['amd.define'];
}

const moduleAliases = options.alias
? parseMappingArgumentAlias(options.alias)
: [];
Expand Down Expand Up @@ -707,6 +716,7 @@ function createConfig(options, entry, format, writeMeta) {
outputOptions: {
paths: outputAliases,
globals,
amd,
strict: options.strict === true,
legacy: true,
freeze: false,
Expand Down
2 changes: 2 additions & 0 deletions src/prog.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default handler => {
.option('--compress', 'Compress output using Terser', null)
.option('--strict', 'Enforce undefined global context and add "use strict"')
.option('--name', 'Specify name exposed in UMD builds')
.option('--amd-name', '[amd] use named define("name", ...)')
.option('--amd-define', '[amd] function to use in place of define()')
.option('--cwd', 'Use an alternative working directory', '.')
.option('--sourcemap', 'Generate source map', true)
.option(
Expand Down