Fullpage.js: Not working with webpack 3

Created on 27 Jul 2017  路  2Comments  路  Source: alvarotrigo/fullPage.js

Description

Hi, Tried several approaches to make fullpage.js work with webpack v3

First approach:

//@ main.js
import 'fullpage.js/dist/jquery.fullpage' // || import 'fullpage.js'

$(document).ready(function() {
    $('#fullpage').fullpage() //$(...).fullpage is not a function
})

//@ webpack.config.js
plugins: [
 new webpack.ProvidePlugin({
    $: 'jquery',
    jQuery: 'jquery'
  }),
  ...
]

Second approach:

//@ main.js
import $ from 'jquery'
import 'fullpage.js/dist/jquery.fullpage'  // || import 'fullpage.js'

$(document).ready(function() {
    $('#fullpage').fullpage() //(0 , _jquery2.default)(...).fullpage is not a function
})

Versions

webpack: 3.0.0
fullpage.js: ^2.9.4
jquery: ^3.2.1

saw few discussions regarding webpack, but none of the is using v3
did anyone encountered it?

question

Most helpful comment

Hello guys, this is what works for me. Please note you have to be using JavaScript ES6.
Hope it helps a bit.

$npm install --save jquery
$npm install --save fullpage.js

webpack.config.js

plugins: [
    new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
    })
]

in your .js file

import fullpage from "fullpage.js"

All 2 comments

Hello guys, this is what works for me. Please note you have to be using JavaScript ES6.
Hope it helps a bit.

$npm install --save jquery
$npm install --save fullpage.js

webpack.config.js

plugins: [
    new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
    })
]

in your .js file

import fullpage from "fullpage.js"

thanks @PeterBielak. I Moved to Typescript and it solved the issue
in my webpack.config.js I added to module.rules this:

{
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/
}

and added two entries, app.ts and vendors.ts

at vendors.ts I used a simple import statement

import 'fullpage.js'

and it works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vishnu1212 picture vishnu1212  路  5Comments

festwertspeicher picture festwertspeicher  路  4Comments

mxnvkv picture mxnvkv  路  4Comments

kacho picture kacho  路  3Comments

LukeCarlThompson picture LukeCarlThompson  路  4Comments