Open franciscolourenco opened 9 years ago
Same issue for me too.
I was able to overcome it by fixing package.json
's main
field (set it to just "./lib/opentip.js"
). But that's not all if you want to use native
adapter. The thing is, the native
adapter automatically tries to attach itself to opentip at the end of the file. The workaround is to create /opentip.js
(relative to document root) of the following content:
/opentip.js
:
var Opentip = require('./node_modules/opentip/lib/opentip.js');
<here goes contents of /lib/adapter-native.js>
module.exports = Opentip;
Then you can do the following:
/index.html
:
<!doctype html>
<html>
<head>
<link href="/opentip.css" rel="stylesheet" type="text/css">
</head>
<body>
<input id="i1" type="text">
<script src="/bundle.js"></script>
</body>
</html>
/index.js
:
var Opentip = require('./opentip.js');
new Opentip('#i1', 'Optional content', {
target: document.getElementById('i1')
, targetJoint: 'right'
, tipJoint: 'left'
, showOn: 'focus'
, hideOn: 'blur'
, style: 'alert'
, fixed: true
})
$ browserify index.js -o bundle.js
Looking forward to a better workaround...