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

Add dependencies to package.json and bower.json #17325

Closed
skrivle opened this issue Aug 26, 2015 · 19 comments
Closed

Add dependencies to package.json and bower.json #17325

skrivle opened this issue Aug 26, 2015 · 19 comments

Comments

@skrivle
Copy link

skrivle commented Aug 26, 2015

In order to let people npm or bower install bootstrap, we should make sure that the package files are updated with the necessary dependencies.

I see two deps (could be that a missed one):

  • jQuery
  • tether

Once the package files are updated we should also remove jQuery and tether from the vendor dir and link to the bower or npm version in the tests.

In order to get completely rid of the vendor folder, we could also add qunit as a dev dependency to the package.json.

X-ref #17201

@cvrebert
Copy link
Collaborator

jQuery is already listed as a dependency. Tether isn't though, and we should fix that.

we should also remove jQuery and tether from the vendor dir and link to the bower or npm version in the tests.

Meh. We don't currently use npm for client-side dependencies. And we definitely don't want to hook into Bower, since it kinda sucks and isn't too actively developed these days.

@skrivle
Copy link
Author

skrivle commented Aug 26, 2015

jQuery is already listed as a dependency. Tether isn't though, and we should fix that.

jQuery is indeed listed in the bower file, but it's still missing in the package file ... I only see jQuery listed under the jspm deps in the package file.

@cvrebert
Copy link
Collaborator

but it's still missing in the package file

Like I said:

We don't currently use npm for client-side dependencies.

@skrivle
Copy link
Author

skrivle commented Aug 26, 2015

@cvrebert If you list npm as one of the possible ways to install bootstrap (which you're doing in the v4 docs) you should make sure all deps can be resolved correctly, no?

@cvrebert
Copy link
Collaborator

Actually we already list npm in the v3 docs (since last year), and nobody seems to have complained about jQuery not being in package.json's dependencies until now...
I can't think of a particular reason not to include it though, so I guess I'm not opposed adding it.
CC: @twbs/team

@skrivle
Copy link
Author

skrivle commented Aug 26, 2015

Probably not a lot of people were using npm to install bootstrap since it wasn't exporting any useful js modules. With the js rewrite of v4 and combined with the rise of tools like browserify and webpack that may change ... Also, like you said I don't think it would do any harm if we add deps to the package file.

@zacechola
Copy link

X-Ref: #17273

I'm 👍 on this one for the same reasons @vejersele listed.

@heruan
Copy link

heruan commented Sep 2, 2015

Absolutely 👍 it would also be very useful to use Bootstrap's JS components with ECMAScript 6 import syntax, e.g.

import {Popover, Modal} from 'bootstrap'

and use them without even knowing they depend on jQuery or Tether.

@cvrebert cvrebert added this to the v4.0.0-alpha.2 milestone Sep 2, 2015
@petetnt
Copy link
Contributor

petetnt commented Sep 23, 2015

👍 for supporting the import syntax.

I am currently trying to include Collapse plugin only and despite being able to load the plugin itself, I have no idea how to satisfy it's requirement for jQuery (despite jQuery being imported right above it) in an ES6 (Babelified) project.

@mdo mdo modified the milestones: v4.0.0-alpha.2, v4.0.0-alpha.3 Dec 8, 2015
@activebiz
Copy link

+1 Same issue here since alpha 2

@reustle
Copy link

reustle commented Jan 17, 2016

Why is tether a dependency if the user doesn't plan on using tooltips? Will this be solved in the final release / compiled version?

@petetnt
Copy link
Contributor

petetnt commented Jan 17, 2016

I started doing the initial legwork on proper (/better) modularization (and dependency management) of the v4 Bootstrap modules today and should have an PR up for review / thoughts some time next week.

Meanwhile @reustle you could mock window.Tether with window.Tether = function (){} to get past the dependency.

@reustle
Copy link

reustle commented Jan 18, 2016

@petetnt I imported the library so it is satisfied for now, I was more curious if the dependency was going to be required in the final release. It seems weird that Bootstrap would need a hard dependency on another library (besides jQuery), especially if it is for a feature you aren't using (tooltips).

@riddla
Copy link

riddla commented Feb 15, 2016

@i just stumbled on another problem. The check of the Tether object being on the global window context (if (window.Tether === undefined)) will always fail if Tether is used within a module loader context.

Tethers distributed version uses the universal module approach (see https://github.com/HubSpot/tether/blob/master/dist/js/tether.js#L3), so there won't be any global if it detects a module environment.

@lsapan
Copy link

lsapan commented Feb 19, 2016

It also seems as though other files may need to be changed. Even when jQuery and tether are installed via npm manually, util.js throws an error because it can't find jQuery in the global scope on line 169.

@cvrebert cvrebert added the js label Mar 7, 2016
@cvrebert
Copy link
Collaborator

Fixed by #18575 & #19427.
Going to say that #19017 covers the module system problems.

@matejsvajger
Copy link

For those currently using bootstrap v4.0.0-alpha.2 through npm you could require Tether as a global instead of a module:

global.Tether = require('tether');

I know it's not perfect, but it's better than placing an empty function on a global Tether variable.

@hougasian
Copy link

The error persists using CDN version.
Not installing via npm or bower.

@cvrebert
Copy link
Collaborator

@hougasian You want #19017.

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

No branches or pull requests