Ray Hulha
Ray Hulha

Reputation: 11221

Isolate used libraries in webpack project

I have written a WebGL JavaScript app to display small models. I am using WebPack 5.66 and some of my users report issues with libraries that I am using. For example I am using lodash and polyfill. Now my users are saying that some important lodash functions are missing. Or that my polyfill is conflicting with their usage of their own polyfills.

How can I create a Webpack app that uses libraries without these libraries affecting other parts of a website other than my own WebGL app ?

Upvotes: 1

Views: 120

Answers (1)

Stewart
Stewart

Reputation: 835

Is the root cause that your clients are using different versions of your libraries, and they are getting overridden by your installed versions?

If so, you could try reinstalling your libraries with a different alias name, and reference that in your code.

npm install [email protected]@npm:lodashNewAliasName
var _ = require('lodashNewAliasName')

Upvotes: 3

Related Questions