Import in webpack

Home Forums Latest release 1.1.x Import in webpack

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9162
    kenfranklin
    Participant

    How to import in Webpack
    import smartmenus from ‘smartmenus’ not working

    #9163
    admin
    Keymaster

    Hi, you need both jquery and smartmenus added to your dependencies in “package.json” – e.g.:

    "jquery": "^3.3.1",
    "smartmenus": "^1.1.1"

    and then in your app’s JS the following should work:

    import $ from 'jquery';
    require('smartmenus');
    
    ...
    
    $('#main-menu').smartmenus();

    The smartmenus module exports jQuery itself so you could even do something like this (without importing jquery separately):

    import $ from 'smartmenus';
    
    ...
    
    $('#main-menu').smartmenus();
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?