Creating custom plugin - need to import node_modules

I’m writing a plugin to use HDRHistogram js:

I’ve read that with external libraries you need to include them in the plugin itself in dist/

so whenever i try to use something like below:
import * as hdr from ‘./hdr-histogram-js/dist/hdrhistogram.min.js’;

it complains about :
Plugin Error
Fetch error: 404 Not Found Instantiating http://hostname:3001/public/pako Loading http://hostname:3001/public/plugins/karl-test-histogram/hdr-histogram-js/dist/hdrhistogram.min.js

So if these libraries depend on others, how do I get around this?

copy js into yours dist/libs and use import ‘./libs/pako’ or use webpack.
i’ve used too pako in plugin flowcharting(utils.js)

I copy the library that I want -> hdr-histogram-js into dist/libs, but that is actually relying on pako, so wouldn’t I then need to make changes to that library (hdr-histogram-js) to refer to ./libs/pako ?

I understand, i choose webpack solution for externals js in node_module

do you have an example of the webpack solution please?