Skip to content
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

How to use ifvisible with webpack #29

Open
kgritesh opened this issue Mar 14, 2016 · 5 comments
Open

How to use ifvisible with webpack #29

kgritesh opened this issue Mar 14, 2016 · 5 comments

Comments

@kgritesh
Copy link

I am unable to understand how does ifvisible initialisation code works. Even if i include it in webpack entry point, i cannot find a global ifvisible object in my namespace. Any help would be really appreciated.

@serkanyersen
Copy link
Owner

when used with webpack like build system ifvisible will not be global. You would have to require it and user the variable. Example

var ifvisible = require('ifvisible.js');

ifvisible.on('idle', function(){
   ...
})

You might need to install ifvisible through npm npm install ifvisible.js --save

if you installed ifvisible in a different way you need to require it from it position such as
var ifvisible = require('./path/to/ifvisible.js');

Hope that clears it up

@henryruhs
Copy link

henryruhs commented Nov 9, 2016

I got a smilar issue with webpack. My library that I try to pack via webpack contains ifvisible.js. For some unknown reason the module cannot be resolved - I have to add another alias for ifvisible and ifvisible.js - if I had to guess: a namespace thing in your AMD pattern is wrong.

Module not found: Error: Cannot resolve module 'ifvisible'
Module not found: Error: Cannot resolve module 'ifvisible.js'

@serkanyersen
Copy link
Owner

Working on V2 at the moment. it will clear all of these issues.

@henryruhs
Copy link

Great!

@serkanyersen
Copy link
Owner

Checkout my comment on #38 any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
ifvisible v2
In Progress
Development

No branches or pull requests

3 participants