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

Webpack, bootstrap and pre-loading jquery #213

Open
gaitat opened this issue May 4, 2017 · 1 comment
Open

Webpack, bootstrap and pre-loading jquery #213

gaitat opened this issue May 4, 2017 · 1 comment

Comments

@gaitat
Copy link

gaitat commented May 4, 2017

Type of issue: (feature suggestion, bug?)

suggestion

Chapter:

8

In chapter 8 you suggest using this code in order to include bootstrap in a project.

import $ from 'jquery'
import Tether from 'tether'

window.jQuery = $
window.Tether = Tether
require('bootstrap') 

Is there a reason not to use the following code that preloads jquery and tether so that you can just do import 'bootstrap'; in the project?

new webpack.ProvidePlugin({
  $: "jquery",
  jQuery: "jquery",
  "window.jQuery": "jquery",
  Tether: "tether",
  "window.Tether": "tether",
}),

The only drawback I have found is that eslint complains about $ being undefined but that can be solved by adding in .eslintrc.json the following:

  "env": {
    "jquery": true
  },
@verekia
Copy link
Owner

verekia commented May 4, 2017

That is probably a cleaner way to do it, thanks for bringing it up :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants