How to require tippy.js in Webpack 3.6?
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
add a comment |
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
add a comment |
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
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
webpack laravel-mix tippyjs
asked Nov 20 '18 at 21:55
RyanRyan
8,657766153
8,657766153
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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"/>
.
add a comment |
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)
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 aboutrequire('tippy.js/dist/tippy.js')
. To include CSS as well:require('tippy.js/dist/tippy.all.js')
– atomiks
Nov 26 '18 at 1:53
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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"/>
.
add a comment |
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"/>
.
add a comment |
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"/>
.
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"/>
.
edited Nov 23 '18 at 14:28
answered Nov 21 '18 at 2:12
RyanRyan
8,657766153
8,657766153
add a comment |
add a comment |
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)
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 aboutrequire('tippy.js/dist/tippy.js')
. To include CSS as well:require('tippy.js/dist/tippy.all.js')
– atomiks
Nov 26 '18 at 1:53
add a comment |
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)
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 aboutrequire('tippy.js/dist/tippy.js')
. To include CSS as well:require('tippy.js/dist/tippy.all.js')
– atomiks
Nov 26 '18 at 1:53
add a comment |
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)
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)
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 aboutrequire('tippy.js/dist/tippy.js')
. To include CSS as well:require('tippy.js/dist/tippy.all.js')
– atomiks
Nov 26 '18 at 1:53
add a comment |
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 aboutrequire('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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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