Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap v4: Tooltip and window.Tether #18647

Closed
n3ssi3 opened this issue Dec 23, 2015 · 4 comments
Closed

Bootstrap v4: Tooltip and window.Tether #18647

n3ssi3 opened this issue Dec 23, 2015 · 4 comments
Labels

Comments

@n3ssi3
Copy link

n3ssi3 commented Dec 23, 2015

While playing around with ReactJS, BS4 and webpack, I ran into an issue with Tether.
Usually I would use import Tether from 'tether' and import Bootstrap from 'bootstrap' but since you use window.Tether I couldn't do that. Now I have to use window.Tether = require('tether').
When mixing import and require that actually affects the loading order. Import seems to be loaded before require, no matter the order in the file. So I have to switch also Bootstrap to require.

Is there a way, we can remove window here?
https://github.com/twbs/bootstrap/blob/v4-dev/js/src/tooltip.js#L19

Or do you have a better idea how to solve this issue?

@cvrebert
Copy link
Collaborator

Approximate duplicate of #17201 / #17325.

@jaredramirez
Copy link

jaredramirez commented Jun 7, 2016

Realized issue is closed but seeing at #17325 is locked to all except collaborators , and #17201 wasn't webpack specific, I thought I'd post my solution here.

Rather than remove if (window.Tether === undefined), try making the Tether variable a global variable using webpack.

module: {
  loaders: [
    { test: /tether\.js$/, loader: "expose?Tether" }
    //other config here
  ]
}

and then in you app.js, include:

import 'tether';
import 'jquery';
import 'bootstrap';

@karolyi
Copy link

karolyi commented Sep 18, 2016

+1, why is this issue closed?

using webpack, because of bootstrap, I had to make jQuery a global variable, BUT then, tether is still looked up in window, in tooltip.js (see here), so the following webpack config snippet, exposing Tether as a global variable for tooltip.js, doesn't help:

      {
        // Transpile ES6 to ES5 in Bootstrap V4
        test: /bootstrap\/js\/src\/.*\.js$/,
        loaders: [
          'imports?jQuery=jquery,Tether=tether',
          'babel?babelrc=true',
        ],
      },

please guys, if you really need us to globally expose variables for bootstrap, at least make it consistent.

@cvrebert
Copy link
Collaborator

why is this issue closed?

See #18647 (comment)

@twbs twbs locked and limited conversation to collaborators Sep 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants