Skip to content

Commit

Permalink
Support global extend via amdName (#713)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
developit authored Aug 31, 2020
1 parent d08f977 commit ffcc9d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilled-paws-confess.md
Original file line number Diff line number Diff line change
@@ -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"`).
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit ffcc9d9

Please sign in to comment.