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

Uncaught TypeError: Cannot set property 'Rellax' of undefined #61

Open
radiocity opened this issue Jun 22, 2017 · 5 comments
Open

Uncaught TypeError: Cannot set property 'Rellax' of undefined #61

radiocity opened this issue Jun 22, 2017 · 5 comments

Comments

@radiocity
Copy link

radiocity commented Jun 22, 2017

Seems like issue #22 not fixed.
I make js bundle using concatination, then filter code by babeljs. Getting following exception:

Uncaught TypeError: Cannot set property 'Rellax' of undefined
    at rellax.js:23
    at rellax.js:23
(anonymous) @ rellax.js:23
(anonymous) @ rellax.js:23

https://github.com/dixonandmoe/rellax/blob/master/rellax.js#L23

The plugin works fine separately from the bundle, but an additional http request is spent :C

@codercodingthecode
Copy link

I'm using webpack/babel
I had the same issue after npm install
For some reason the library is not loaded onto the final script causing that error.

This is how I got it working after npm install

let Rellax = require('rellax')
let rellax = new Rellax('.rellax')

@moeamaya
Copy link
Member

@andythedandyone Really late reply, but do you know how I can automatically load the script with the require?

@radiocity
Copy link
Author

@moeamaya, is it possible to rewrite rellax into es6 classes?

@jcklpe
Copy link

jcklpe commented Nov 7, 2018

@codercodingthecode Where do you put the require statements? Is that in the webpack? or do you put it along with wherever the script calls the init function in the html?

@jcklpe
Copy link

jcklpe commented Nov 7, 2018

Oh I figured it out. At least for webpack 4. I just just added const Rellax = require('rellax'); up at the top of my webpack and then threw the init function into the app.js like I was doing originally.

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

No branches or pull requests

4 participants