How to require tippy.js in Webpack 3.6?












0















I'm using Laravel Mix, which uses Webpack 3.6, and I'm trying to install https://atomiks.github.io/tippyjs/.



My SCSS is probably working fine via @import "../../../../node_modules/tippy.js/dist/tippy.css";.



However, at the top of my javascript file, I have this, which doesn't work:



var $ = require('jquery');
var webcast_helper = require('webcast_helper');
var moment = require('moment');
import tippy from 'tippy.js';


I get error: Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'



How can I import Tippy.js in a way that works with this Webpack approach?



(How to import tippy.js into an html page with webpack 4? obviously doesn't work for me.)










share|improve this question



























    0















    I'm using Laravel Mix, which uses Webpack 3.6, and I'm trying to install https://atomiks.github.io/tippyjs/.



    My SCSS is probably working fine via @import "../../../../node_modules/tippy.js/dist/tippy.css";.



    However, at the top of my javascript file, I have this, which doesn't work:



    var $ = require('jquery');
    var webcast_helper = require('webcast_helper');
    var moment = require('moment');
    import tippy from 'tippy.js';


    I get error: Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'



    How can I import Tippy.js in a way that works with this Webpack approach?



    (How to import tippy.js into an html page with webpack 4? obviously doesn't work for me.)










    share|improve this question

























      0












      0








      0








      I'm using Laravel Mix, which uses Webpack 3.6, and I'm trying to install https://atomiks.github.io/tippyjs/.



      My SCSS is probably working fine via @import "../../../../node_modules/tippy.js/dist/tippy.css";.



      However, at the top of my javascript file, I have this, which doesn't work:



      var $ = require('jquery');
      var webcast_helper = require('webcast_helper');
      var moment = require('moment');
      import tippy from 'tippy.js';


      I get error: Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'



      How can I import Tippy.js in a way that works with this Webpack approach?



      (How to import tippy.js into an html page with webpack 4? obviously doesn't work for me.)










      share|improve this question














      I'm using Laravel Mix, which uses Webpack 3.6, and I'm trying to install https://atomiks.github.io/tippyjs/.



      My SCSS is probably working fine via @import "../../../../node_modules/tippy.js/dist/tippy.css";.



      However, at the top of my javascript file, I have this, which doesn't work:



      var $ = require('jquery');
      var webcast_helper = require('webcast_helper');
      var moment = require('moment');
      import tippy from 'tippy.js';


      I get error: Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'



      How can I import Tippy.js in a way that works with this Webpack approach?



      (How to import tippy.js into an html page with webpack 4? obviously doesn't work for me.)







      webpack laravel-mix tippyjs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 21:55









      RyanRyan

      8,657766153




      8,657766153
























          2 Answers
          2






          active

          oldest

          votes


















          0














          I'd prefer to accept an answer from someone who can show me how to get 3.2.0 to work.



          I was able to get an older version (2.6.0) to work (partially).



          npm install tippy.js@2.6.0



          In my file:



          const tippy = require('tippy.js');
          tippy($(inputRangeEl).get(0), {
          content: "Rewind by clicking anywhere on this red slider",
          arrow: true,
          duration: [0, 1000], // Array [show, hide]
          followCursor: "horizontal",
          size: 'large',
          animation: 'scale'
          });


          But the tooltips unfortunately never appear on touch devices (such as iPhone) and I don't know why.



          I'm trying to have a tooltip on <input type="range" id="position" name="position" step="1" min="0" max="1" value="1" title="Rewind by clicking anywhere on this red slider"/>.






          share|improve this answer

































            0














            import tippy from 'tippy.js' uses the ESM version (the "module" field in package.json).



            Try: var tippy = require('tippy.js');



            To use the UMD version (supports CJS)






            share|improve this answer
























            • Thanks, but I already tried that, and it seems to work for 2.6.0 but not 3.2.0, as I mentioned here: stackoverflow.com/a/53404391/470749

              – Ryan
              Nov 26 '18 at 0:09











            • How about require('tippy.js/dist/tippy.js'). To include CSS as well: require('tippy.js/dist/tippy.all.js')

              – atomiks
              Nov 26 '18 at 1:53













            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%2f53402195%2fhow-to-require-tippy-js-in-webpack-3-6%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I'd prefer to accept an answer from someone who can show me how to get 3.2.0 to work.



            I was able to get an older version (2.6.0) to work (partially).



            npm install tippy.js@2.6.0



            In my file:



            const tippy = require('tippy.js');
            tippy($(inputRangeEl).get(0), {
            content: "Rewind by clicking anywhere on this red slider",
            arrow: true,
            duration: [0, 1000], // Array [show, hide]
            followCursor: "horizontal",
            size: 'large',
            animation: 'scale'
            });


            But the tooltips unfortunately never appear on touch devices (such as iPhone) and I don't know why.



            I'm trying to have a tooltip on <input type="range" id="position" name="position" step="1" min="0" max="1" value="1" title="Rewind by clicking anywhere on this red slider"/>.






            share|improve this answer






























              0














              I'd prefer to accept an answer from someone who can show me how to get 3.2.0 to work.



              I was able to get an older version (2.6.0) to work (partially).



              npm install tippy.js@2.6.0



              In my file:



              const tippy = require('tippy.js');
              tippy($(inputRangeEl).get(0), {
              content: "Rewind by clicking anywhere on this red slider",
              arrow: true,
              duration: [0, 1000], // Array [show, hide]
              followCursor: "horizontal",
              size: 'large',
              animation: 'scale'
              });


              But the tooltips unfortunately never appear on touch devices (such as iPhone) and I don't know why.



              I'm trying to have a tooltip on <input type="range" id="position" name="position" step="1" min="0" max="1" value="1" title="Rewind by clicking anywhere on this red slider"/>.






              share|improve this answer




























                0












                0








                0







                I'd prefer to accept an answer from someone who can show me how to get 3.2.0 to work.



                I was able to get an older version (2.6.0) to work (partially).



                npm install tippy.js@2.6.0



                In my file:



                const tippy = require('tippy.js');
                tippy($(inputRangeEl).get(0), {
                content: "Rewind by clicking anywhere on this red slider",
                arrow: true,
                duration: [0, 1000], // Array [show, hide]
                followCursor: "horizontal",
                size: 'large',
                animation: 'scale'
                });


                But the tooltips unfortunately never appear on touch devices (such as iPhone) and I don't know why.



                I'm trying to have a tooltip on <input type="range" id="position" name="position" step="1" min="0" max="1" value="1" title="Rewind by clicking anywhere on this red slider"/>.






                share|improve this answer















                I'd prefer to accept an answer from someone who can show me how to get 3.2.0 to work.



                I was able to get an older version (2.6.0) to work (partially).



                npm install tippy.js@2.6.0



                In my file:



                const tippy = require('tippy.js');
                tippy($(inputRangeEl).get(0), {
                content: "Rewind by clicking anywhere on this red slider",
                arrow: true,
                duration: [0, 1000], // Array [show, hide]
                followCursor: "horizontal",
                size: 'large',
                animation: 'scale'
                });


                But the tooltips unfortunately never appear on touch devices (such as iPhone) and I don't know why.



                I'm trying to have a tooltip on <input type="range" id="position" name="position" step="1" min="0" max="1" value="1" title="Rewind by clicking anywhere on this red slider"/>.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 23 '18 at 14:28

























                answered Nov 21 '18 at 2:12









                RyanRyan

                8,657766153




                8,657766153

























                    0














                    import tippy from 'tippy.js' uses the ESM version (the "module" field in package.json).



                    Try: var tippy = require('tippy.js');



                    To use the UMD version (supports CJS)






                    share|improve this answer
























                    • Thanks, but I already tried that, and it seems to work for 2.6.0 but not 3.2.0, as I mentioned here: stackoverflow.com/a/53404391/470749

                      – Ryan
                      Nov 26 '18 at 0:09











                    • How about require('tippy.js/dist/tippy.js'). To include CSS as well: require('tippy.js/dist/tippy.all.js')

                      – atomiks
                      Nov 26 '18 at 1:53


















                    0














                    import tippy from 'tippy.js' uses the ESM version (the "module" field in package.json).



                    Try: var tippy = require('tippy.js');



                    To use the UMD version (supports CJS)






                    share|improve this answer
























                    • Thanks, but I already tried that, and it seems to work for 2.6.0 but not 3.2.0, as I mentioned here: stackoverflow.com/a/53404391/470749

                      – Ryan
                      Nov 26 '18 at 0:09











                    • How about require('tippy.js/dist/tippy.js'). To include CSS as well: require('tippy.js/dist/tippy.all.js')

                      – atomiks
                      Nov 26 '18 at 1:53
















                    0












                    0








                    0







                    import tippy from 'tippy.js' uses the ESM version (the "module" field in package.json).



                    Try: var tippy = require('tippy.js');



                    To use the UMD version (supports CJS)






                    share|improve this answer













                    import tippy from 'tippy.js' uses the ESM version (the "module" field in package.json).



                    Try: var tippy = require('tippy.js');



                    To use the UMD version (supports CJS)







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 25 '18 at 23:46









                    atomiksatomiks

                    9614




                    9614













                    • Thanks, but I already tried that, and it seems to work for 2.6.0 but not 3.2.0, as I mentioned here: stackoverflow.com/a/53404391/470749

                      – Ryan
                      Nov 26 '18 at 0:09











                    • How about require('tippy.js/dist/tippy.js'). To include CSS as well: require('tippy.js/dist/tippy.all.js')

                      – atomiks
                      Nov 26 '18 at 1:53





















                    • Thanks, but I already tried that, and it seems to work for 2.6.0 but not 3.2.0, as I mentioned here: stackoverflow.com/a/53404391/470749

                      – Ryan
                      Nov 26 '18 at 0:09











                    • How about require('tippy.js/dist/tippy.js'). To include CSS as well: require('tippy.js/dist/tippy.all.js')

                      – atomiks
                      Nov 26 '18 at 1:53



















                    Thanks, but I already tried that, and it seems to work for 2.6.0 but not 3.2.0, as I mentioned here: stackoverflow.com/a/53404391/470749

                    – Ryan
                    Nov 26 '18 at 0:09





                    Thanks, but I already tried that, and it seems to work for 2.6.0 but not 3.2.0, as I mentioned here: stackoverflow.com/a/53404391/470749

                    – Ryan
                    Nov 26 '18 at 0:09













                    How about require('tippy.js/dist/tippy.js'). To include CSS as well: require('tippy.js/dist/tippy.all.js')

                    – atomiks
                    Nov 26 '18 at 1:53







                    How about require('tippy.js/dist/tippy.js'). To include CSS as well: require('tippy.js/dist/tippy.all.js')

                    – atomiks
                    Nov 26 '18 at 1:53




















                    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%2f53402195%2fhow-to-require-tippy-js-in-webpack-3-6%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

                    'app-layout' is not a known element: how to share Component with different Modules

                    android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                    WPF add header to Image with URL pettitions [duplicate]