From 0005a962aa4f824f6185ee44b7bcfc7b2509c970 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Mon, 31 Aug 2020 10:05:08 -0400 Subject: [PATCH] Support global extend via amdName Using a prefixed name like `{ "amdName": "global.foo" }` will trigger Rollup's `output.extend` option. This addresses the use-case from #709 without adding another CLI flag. --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 87a9601f..7e1a8ee2 100644 --- a/src/index.js +++ b/src/index.js @@ -590,7 +590,8 @@ function createConfig(options, entry, format, writeMeta) { return shebang[options.name]; }, format: modern ? 'es' : format, - name: options.name, + name: options.name && options.name.replace(/^global\./, ''), + extend: /^global\./.test(options.name), dir: outputDir, entryFileNames: outputEntryFileName, },