Closed ghost closed 9 years ago
Very nice idea! This would be a great opt-in option, as I'm afraid that making this the default could be little confusing.
For now, can I use your snippet in universe:modules docs?
For now, can I use your snippet in universe:modules docs?
Sure. The code is MIT licensed. ;-)
Hello @Sanjo
We decided to add access to exported variables by "!var" in future we want to protect against using not declared global variables in import.js(x) files for developing mode.
import {DDP} from '{ddp}!vars'
import {UniCollection, UniUsers} from '{vazco:universe-collection}!vars'
https://github.com/vazco/universe-modules#user-content-loading-package-level-variables
To bring existing Meteor packages into the ES2015 module system I have written the appended code to map the package exports to SystemJS.
Lets say there is the Meteor package
sanjo:foo
that exportsFoo
viaapi.export('Foo')
. The mapping code maps this export to the package reference{sanjo:foo}
. Because the package has only one export,Foo
will also become the default export.In your app that uses the ES2015 module system you can now use the export
Foo
viaimport {Foo} from '{sanjo:foo}'
. Or via default import syntax:import Foo from '{sanjo:foo}'
.If the package would have another export
Bar
, you could import it viaimport {Bar} from '{sanjo:foo}'
.An example app that uses this can be found here.