Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • J js-stack-from-scratch
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 39
    • Issues 39
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Verekia
  • js-stack-from-scratch
  • Issues
  • #213
Closed
Open
Issue created May 04, 2017 by gaitat@gaitat

Webpack, bootstrap and pre-loading jquery

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
  },
Assignee
Assign to
Time tracking