Skip to content

"$ is undefined" with .autoProvidejQuery() and jQuery plugin #52

@heitorvrb

Description

@heitorvrb

I'm trying to use the "foundation-datepicker" package and getting "TypeError: $ is undefined".

app/Resources/js/app.js:

require('foundation-sites');
require('foundation-datepicker/js/foundation-datepicker.js');
[...]

.autoProvidejQuery() is enabled in webpack.config.js. .autoProvidejQuery() works with other jQuery-dependant packages, but when I add this one, it gives the error.

Could it be something in the package? According to the browser profiler, the guilty lines in foundation-datepicker.js are:

! function($) {

[...]

$.fn.fdatepicker = function(option) {

[...]

What should I do? Sorry if this is not very webpack-encore specific.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions