-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Allow for system format modules to be named. Fixes #2027 #2028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| module.exports = { | ||
| description: 'names bundles correctly', | ||
| options: { | ||
| output: { | ||
| name: 'libraryName', | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before this pr, this name was ignored in the outputted System.register format. |
||
| }, | ||
| } | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| define(['exports'], function (exports) { 'use strict'; | ||
|
|
||
| const valueOnLib = 42; | ||
|
|
||
| exports.valueOnLib = valueOnLib; | ||
|
|
||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
|
||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
|
||
| const valueOnLib = 42; | ||
|
|
||
| exports.valueOnLib = valueOnLib; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| const valueOnLib = 42; | ||
|
|
||
| export { valueOnLib }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| var libraryName = (function (exports) { | ||
| 'use strict'; | ||
|
|
||
| const valueOnLib = 42; | ||
|
|
||
| exports.valueOnLib = valueOnLib; | ||
|
|
||
| return exports; | ||
|
|
||
| }({})); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| System.register('libraryName', [], function (exports, module) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before my pr, |
||
| 'use strict'; | ||
| return { | ||
| execute: function () { | ||
|
|
||
| const valueOnLib = exports('valueOnLib', 42); | ||
|
|
||
| } | ||
| }; | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| (function (global, factory) { | ||
| typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
| typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
| (factory((global.libraryName = {}))); | ||
| }(this, (function (exports) { 'use strict'; | ||
|
|
||
| const valueOnLib = 42; | ||
|
|
||
| exports.valueOnLib = valueOnLib; | ||
|
|
||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
|
||
| }))); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const valueOnLib = 42 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through rollup's documentation, I think using
namehere is an abuse of this option which is meant to define global variable names for IIFE/umd bundles (maybe we want to add SystemJS to our umd output at some point?). As @guybedford pointed out, theamd.idoption would be more equivalent except for theamdpart of the name. So I would prefer deprecatingamd.idin favour of a new output option. Not sure what the best name could be; we could call it something likemoduleIdas it is the id of the generated module as used by the loader. Maybe @guybedford has a more elaborate opinion on this.