Closed hamilton-keisuke closed 2 years ago
The bootstrap-multiselect
does not export a valid commonjs module, in which case esbuild won't handle it well. If you look at the top of that library, it does handle AMD and global variable cases.
At the esbuild side, a top level this
will be changed to exports
in commonjs context, see it in action. This allows some no-dependency libraries to partially work. But bootstrap-multiselect
depends on a global name $
, in which case exports.$
(originally this.$
) does not exist in such isolated context.
I think you can write a plugin
to edit that library to a valid commonjs module, or just replace the global this
to window
by --define:this=window
.
Thanks a lot.
define:this=window
works well.
I will try write plugin, too :D
Excuse me. I want to build with esbuild including bootstrap-multiselect.
However, I get the following error in browser's js console.
Here is sample code, reproducing this problem. https://github.com/hamilton-keisuke/esbuild-bootstrap-multiselect-sample
In webpack, I solved it with imports-loader as below.
I want to resolve this probrem. Is there any way?