Support global extend via amdName (#713)

* 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.

* Create chilled-paws-confess.md

* Update chilled-paws-confess.md
This commit is contained in:
Jason Miller 2020-08-31 11:00:45 -04:00 committed by GitHub
parent d08f977aa6
commit ffcc9d9b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"microbundle": patch
---
Support [extending a UMD global](https://rollupjs.org/guide/en/#outputextend) by prefixing the package.json `"amdName"` field (eg: `"global.xyz"`).

View File

@ -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,
},