Skip to content

Commit 7ca45d5

Browse files
author
Federico Zivolo
committed
fix(build): Use UMD and fix build to properly load deps
1 parent ffc5965 commit 7ca45d5

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

build/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
input: path.resolve(__dirname, '../js/src/index.js'),
3838
output: {
3939
file: path.resolve(__dirname, `../dist/js/${fileDest}`),
40-
format: 'iife'
40+
format: 'umd'
4141
},
4242
name: 'bootstrap',
4343
external,

docs/4.0/getting-started/webpack.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,9 @@ import 'bootstrap/js/dist/dropdown';
2626
...
2727
{% endhighlight %}
2828

29-
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:
30-
31-
{% highlight js %}
32-
// don't forget to import webpack (using import or require) to use webpack.ProvidePlugin
33-
plugins: [
34-
...
35-
new webpack.ProvidePlugin({
36-
$: 'jquery',
37-
jQuery: 'jquery',
38-
'window.jQuery': 'jquery',
39-
Popper: ['popper.js', 'default'],
40-
// In case you imported plugins individually, you must also require them here:
41-
Util: "exports-loader?Util!bootstrap/js/dist/util",
42-
Dropdown: "exports-loader?Dropdown!bootstrap/js/dist/dropdown",
43-
...
44-
})
45-
...
46-
]
47-
{% endhighlight %}
29+
Bootstrap is dependent on [jQuery](https://jquery.com/) and [Popper](https://popper.js.org/),
30+
these are defined as `peerDependencies`, this means that you will have to make sure to add both of them
31+
to your `package.json` using `npm --save jquery popper.js`.
4832

4933
{% callout warning %}
5034
Notice that if you chose to **import plugins individually**, you must also install [exports-loader](https://github.com/webpack-contrib/exports-loader)

0 commit comments

Comments
 (0)