Critical dependency npm warning

Here is the plugin.
I’m getting this warning whenever I require bootstrap-multiselect plugin and compile it:

WARNING in ./node_modules/bootstrap-multiselect/dist/js/bootstrap-multiselect.js 48:48-55
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ ./resources/js/bootstrap.js
@ ./resources/js/app.js
@ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/bootstrap-multiselect/dist/js/bootstrap-multiselect.js 48:84-91
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ ./resources/js/bootstrap.js
@ ./resources/js/app.js
@ multi ./resources/js/app.js ./resources/sass/app.scss

Here is the line 48 of bootstrap-multiselect.js

typeof require === 'function' && typeof require.specified === 'function' && require.specified('knockout'))

What exactly is your question?
If there is an issue with Github plugin then you should create an issue there: https://github.com/davidstutz/bootstrap-multiselect/issues

This library is still in beta, hence the 0.*.* version. There can still be many braking changes until the full release.

I would suggest installing older versions which work:
Latest version
npm i bootstrap-multiselect@latest

Exact version
npm i bootstrap-multiselect@0.9.11

Worth pointing out it’s just a warning, not an error.

Seems it doesn’t like require.specified as a syntax.

1 Like

I removed the specified and there’s no warning appeared. But the plugin may not like the change that it breaks it feature or something.

Again, I don’t know that a change was necessary; it’s a warning, the code still executed.