I am using jspm for the first time and already ran into a snag.
I need to figure out how to "shim" a proprietary script which lives on our company's private npm registry.
Package: widget
- Resides on private npm registry
- Is not a CommonJS, UMD/AMD module
- Depends on
lodash
andjquery
, but assumes they exist on global scope - Exposes
Widget
on the global scope
Here's the (hypothetical) code
var Widget = {
render: function(el, symbol) {
symbol = _.trim(symbol);
$(el).text(symbol);
}
};
app.js
var widget = require("Widget");
widget.render(document.getElementById("name"), " Fred ");
index.html
<body>
<div id="name"></div>
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script>
System.import("app");
</script>
</body>
When I run this page in a local web server, I get an error:
Uncaught Reference: _ is not defined
How can I provide a "shim" for widget
?