Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • 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
  • Bootstrap
  • bootstrap
  • Merge requests
  • !28386

build bootstrap in esm

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge v5-dev-jo-esm into master Mar 01, 2019
  • Overview 0
  • Commits 7
  • Pipelines 0
  • Changes 52

Created by: Johann-S

I continue my todo list for v5.

Our main dist file will be available as a module and next step we'll have to build our plugins in ESM too. Not sure about building our modules in ESM too because they are available separately.

What does it add for our users ?

use Bootstrap as a module in their browser

<script type="module">
  import { Toast } from 'bootstrap.esm.min.js'

  Array.from(document.querySelectorAll('.toast'))
    .forEach((toastNode) => new Toast(toastNode))
</script>

And bundlers will load the ESM version because we added module in our package.json

TODO:

  • See if we need the babel object spread plugin for our target browsers
  • Explain the known issue with the plugins that require Popper and link to https://developers.google.com/web/fundamentals/primers/modules#package-name-maps. Maybe make this an info/warning callout

Demo: https://codepen.io/Johann-S/pen/XGdLVK

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: v5-dev-jo-esm