Fullpage.js: Not support webpack?

Created on 3 Jul 2016  Β·  10Comments  Β·  Source: alvarotrigo/fullPage.js

After installed fullpage.js by npm, and I used it throught webpack like this:

import 'fullpage.js';

$(function() {
    $('#fullpage').fullpage({
        navigation: true
    });
});

then output error like this:

jQuery.Deferred exception: $(...).fullpage is not a function 
TypeError: $(...).fullpage is not a function
question

Most helpful comment

@alvarotrigo Problem has been solved.
I have created vendor.entry.js source file with following content

window.$ = window.jQuery = require('jquery')
import 'fullpage.js/jquery.fullPage.js'

and bundle of this file is imported in html above application logic bundle

All 10 comments

You might need to use jquery.fullpage.js. Not just fullpage.js.

fullPage.js provides support for the universal module definition (UMD), which includes AMD, commonJS and node modules.

For anyone who might still be confused, it works if you import it like this:

import 'fullpage.js/jquery.fullpage.js';

@rravikot I've imported just like you but the problem is same :)

@ShavidzeT are you using the latest fullpage.js version? 2.8.5 ?
There was an issue which was solved in 2.8.5 regarding webpack and commonJs

@alvarotrigo Problem has been solved.
I have created vendor.entry.js source file with following content

window.$ = window.jQuery = require('jquery')
import 'fullpage.js/jquery.fullPage.js'

and bundle of this file is imported in html above application logic bundle

i had the same error TypeError: $(...).fullpage is not a function when working my project with [email protected] (using webpack).
Then I tried to downgrade it to [email protected].
It wont work at first, however I found there was a node_modules directry contains another jquery inside the fullpage.js.
After removing it, fullpage.js worked.

β”œβ”€β”€ node_modules
β”‚ β”œβ”€β”€ fullpage.js
β”‚ β”‚ β”œβ”€β”€ README.md
β”‚ β”‚ β”œβ”€β”€ jquery.fullPage.js
β”‚ β”‚ β”œβ”€β”€ package.json
β”‚ β”‚ β”œβ”€β”€ jquery.fullPage.css
β”‚ β”‚ β”œβ”€β”€vendors
β”‚ β”‚ └── node_modules
β”‚ β”‚ β”‚ β”œβ”€β”€ jquery

If anyone had the same problem with fullpage.[email protected] and webpack, maybe could try to downgrade it to fullpage.[email protected] and
rm -rf my_awesome_project/node_modules/fullpage.js/node_modules

Then just

import 'fullpage.js/jquery.fullPage.js';

$('#fullpage').fullpage({
    ...
});

@edwardfhsiao I don't see why it shouldn't work with 2.8.7. There was a small change in the package.json file but the rest of changes shouldn't interfiere at all as far as I know.

@alvarotrigo Yes, You were right. I tried 2.8.7 again and it worked.
The fundamental interfierence is the Jquery inside the fullpage.js/node_modules.
Thanks for your time.

@edwardfhsiao as far as I know fullPage.js doesn't include any node_modules by default. They are only necessary if you want to create your own build as detailed in the docs. Also, even when doing so, there's no jquery dev dependency in the package.json file.

@alvarotrigo yeah, I guess it must be my setting issue which irrelevant to fullpage.js. I also encountered the same problem(multi jquery) with pickadate and ujs in the past. really appreciate

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pepi3 picture pepi3  Β·  4Comments

vanloc0301 picture vanloc0301  Β·  5Comments

festwertspeicher picture festwertspeicher  Β·  4Comments

piaomiao picture piaomiao  Β·  5Comments

vishnu1212 picture vishnu1212  Β·  5Comments