Can't use select2 with supposedly shimmed jQuery (npm + Browserify)Shimming dependencies of dependencies with browserify-shimBrowserify - How to include non-public purchased third party scriptsAlias a npm module with browserify shimUse select2 version 4.0 with NPM and browserifyExtracting vendor libraries from factor-bundleNPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackHow to shim npm package dependency in browserify?How do I use jquery plugins with browserify?browserify and browserify-shim, do we really need browserify-shim?How to bundle Angularjs and jQuery npm modules and customized libraries with Browserify and Gulp?

How do I stop my characters falling in love?

Timing/Stack question about abilities triggered during combat

expansion with *.txt in the shell doesn't work if no .txt file exists

Is it normal practice to screen share with a client?

What is the meaning of "you has the wind of me"?

How acidic does a mixture have to be for milk to curdle?

How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?

Why is chess failing to attract big name sponsors?

What exactly makes a General Products hull nearly indestructible?

Is it better to memorize verb's 1st person perfect tense?

How to get the two pictures aligned

What is the lowest-speed bogey a jet fighter can intercept/escort?

Time travel novel: machine makes clones, clones battle to be the one to get back their life

Area of parallelogram = Area of square. Shear transform

What to do when you reach a conclusion and find out later on that someone else already did?

Iterate over non-const variables in C++

How to copy a file transactionally?

This message is flooding my syslog, how to find where it comes from?

Can the 2019 UA Artificer's Returning Weapon and Radiant Weapon infusions stack on the same weapon?

How do I address my Catering staff subordinate seen eating from a chafing dish before the customers?

Why is my read in of data taking so long?

Is dd if=/dev/urandom of=/dev/mem safe?

Why can't my huge trees be chopped down?

Why are so many countries still in the Commonwealth?



Can't use select2 with supposedly shimmed jQuery (npm + Browserify)


Shimming dependencies of dependencies with browserify-shimBrowserify - How to include non-public purchased third party scriptsAlias a npm module with browserify shimUse select2 version 4.0 with NPM and browserifyExtracting vendor libraries from factor-bundleNPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackHow to shim npm package dependency in browserify?How do I use jquery plugins with browserify?browserify and browserify-shim, do we really need browserify-shim?How to bundle Angularjs and jQuery npm modules and customized libraries with Browserify and Gulp?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'm using npm together with Browserify to package all my libraries/plugins.



Everything is working fine except for select2. I've tried all browserify-shim related fixes and nothing is making it work.



Here are how my files are currently:



package.json



 "devDependencies": 
"axios": "^0.18",
"bootstrap": "^4.3.1",
"browserify-shim": "^3.8.14",
"cross-env": "^5.1",
"jquery": "^3.3.1",
"laravel-mix": "^4.0.15",
"lodash": "^4.17.11",
"popper.js": "^1.14.7"
,
"browserify":
"transform": ["browserify-shim"]
,
"browserify-shim":
"jquery": "$"
,


module-loads.js



/* JQuery */
global.jQuery = global.$ = require("jquery");


/* Select2 */
global.select2 = require('select2');


The settings above throw no errors whatsoever except Uncaught TypeError: $(...).select2 is not a function when attempting to initialize select2.



Any thoughts? Thanks for your attention.










share|improve this question




























    1















    I'm using npm together with Browserify to package all my libraries/plugins.



    Everything is working fine except for select2. I've tried all browserify-shim related fixes and nothing is making it work.



    Here are how my files are currently:



    package.json



     "devDependencies": 
    "axios": "^0.18",
    "bootstrap": "^4.3.1",
    "browserify-shim": "^3.8.14",
    "cross-env": "^5.1",
    "jquery": "^3.3.1",
    "laravel-mix": "^4.0.15",
    "lodash": "^4.17.11",
    "popper.js": "^1.14.7"
    ,
    "browserify":
    "transform": ["browserify-shim"]
    ,
    "browserify-shim":
    "jquery": "$"
    ,


    module-loads.js



    /* JQuery */
    global.jQuery = global.$ = require("jquery");


    /* Select2 */
    global.select2 = require('select2');


    The settings above throw no errors whatsoever except Uncaught TypeError: $(...).select2 is not a function when attempting to initialize select2.



    Any thoughts? Thanks for your attention.










    share|improve this question
























      1












      1








      1








      I'm using npm together with Browserify to package all my libraries/plugins.



      Everything is working fine except for select2. I've tried all browserify-shim related fixes and nothing is making it work.



      Here are how my files are currently:



      package.json



       "devDependencies": 
      "axios": "^0.18",
      "bootstrap": "^4.3.1",
      "browserify-shim": "^3.8.14",
      "cross-env": "^5.1",
      "jquery": "^3.3.1",
      "laravel-mix": "^4.0.15",
      "lodash": "^4.17.11",
      "popper.js": "^1.14.7"
      ,
      "browserify":
      "transform": ["browserify-shim"]
      ,
      "browserify-shim":
      "jquery": "$"
      ,


      module-loads.js



      /* JQuery */
      global.jQuery = global.$ = require("jquery");


      /* Select2 */
      global.select2 = require('select2');


      The settings above throw no errors whatsoever except Uncaught TypeError: $(...).select2 is not a function when attempting to initialize select2.



      Any thoughts? Thanks for your attention.










      share|improve this question














      I'm using npm together with Browserify to package all my libraries/plugins.



      Everything is working fine except for select2. I've tried all browserify-shim related fixes and nothing is making it work.



      Here are how my files are currently:



      package.json



       "devDependencies": 
      "axios": "^0.18",
      "bootstrap": "^4.3.1",
      "browserify-shim": "^3.8.14",
      "cross-env": "^5.1",
      "jquery": "^3.3.1",
      "laravel-mix": "^4.0.15",
      "lodash": "^4.17.11",
      "popper.js": "^1.14.7"
      ,
      "browserify":
      "transform": ["browserify-shim"]
      ,
      "browserify-shim":
      "jquery": "$"
      ,


      module-loads.js



      /* JQuery */
      global.jQuery = global.$ = require("jquery");


      /* Select2 */
      global.select2 = require('select2');


      The settings above throw no errors whatsoever except Uncaught TypeError: $(...).select2 is not a function when attempting to initialize select2.



      Any thoughts? Thanks for your attention.







      npm jquery-select2 browserify browserify-shim






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 17:10









      joao-m-santosjoao-m-santos

      731 silver badge9 bronze badges




      731 silver badge9 bronze badges






















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362717%2fcant-use-select2-with-supposedly-shimmed-jquery-npm-browserify%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362717%2fcant-use-select2-with-supposedly-shimmed-jquery-npm-browserify%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript