What I'm trying to do is define a module of utility functions, browserify it and use it in a polymer component. Since this post: require is not defined error with browserify makes it clear that 'require' is only defined within the scope of the bundle (xx.js), I need help figuring out how to access my exported function.
Here is the gist:
file: x.js
module.exports = function() {console.log("hi");}
I run
browserify x.js> xx.js
file xx.js (edited)
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==...
module.exports = function() {console.log("hi");}
},{}]},{},[1]);
My polymer component (edited)
<link rel="import" href="../../bower_components/polymer/polymer.html">
<script type="text/javascript" src="xx.js"></script>
<dom-module id="Hello-app">
<template> </template>
<script>
Polymer({
is: 'Hello-app',
ready: function() {/* how do I access the function here, so it prints "hi" */}
});
</script>
</dom-module>