]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Use UMD and fix build to properly load deps (#24783)
authorFederico Zivolo <federico.zivolo@gmail.com>
Wed, 15 Nov 2017 13:13:33 +0000 (14:13 +0100)
committerJohann-S <johann.servoire@gmail.com>
Wed, 15 Nov 2017 13:13:33 +0000 (14:13 +0100)
build/rollup.config.js
docs/4.0/getting-started/webpack.md

index 99bf637c0d891fd6702bac2709f7f6833daf91a1..dc5fa6cced40dd6d2eea8a85bf40e1d38238dbd8 100644 (file)
@@ -37,7 +37,7 @@ module.exports = {
   input: path.resolve(__dirname, '../js/src/index.js'),
   output: {
     file: path.resolve(__dirname, `../dist/js/${fileDest}`),
-    format: 'iife'
+    format: 'umd'
   },
   name: 'bootstrap',
   external,
index 29a2bd83187e29cac87882f0e95809c8917dbaf8..4093b12abc4556ef484c96420fee79ef725cf3c8 100644 (file)
@@ -26,25 +26,9 @@ import 'bootstrap/js/dist/dropdown';
 ...
 {% endhighlight %}
 
-Bootstrap is dependent on [jQuery](https://jquery.com/) and [Popper](https://popper.js.org/), so npm will install them for you if needed. But they must be explicitly provided by webpack. Add the following code to the `plugins` section in your webpack config file:
-
-{% highlight js %}
-  // don't forget to import webpack (using import or require) to use webpack.ProvidePlugin
-  plugins: [
-    ...
-      new webpack.ProvidePlugin({
-        $: 'jquery',
-        jQuery: 'jquery',
-        'window.jQuery': 'jquery',
-        Popper: ['popper.js', 'default'],
-        // In case you imported plugins individually, you must also require them here:
-        Util: "exports-loader?Util!bootstrap/js/dist/util",
-        Dropdown: "exports-loader?Dropdown!bootstrap/js/dist/dropdown",
-        ...
-      })
-    ...
-  ]
-{% endhighlight %}
+Bootstrap is dependent on [jQuery](https://jquery.com/) and [Popper](https://popper.js.org/),
+these are defined as `peerDependencies`, this means that you will have to make sure to add both of them
+to your `package.json` using `npm --save jquery popper.js`.
 
 {% callout warning %}
 Notice that if you chose to **import plugins individually**, you must also install [exports-loader](https://github.com/webpack-contrib/exports-loader)