1

I am importing the npm module JSEncrypt in my module to encrypt data. JSEncrypt has window exported global object window.Base64.

I am using webpack to bundle all modules. After bundling I run the code on the browser I can write on console window.Base64 to get the value of this object.

For security and compatibility reasons I would like to prevent that by changing window.Base64 to local scope instead of window.

Is that possible through webpack?

Jameel
  • 2,926
  • 1
  • 12
  • 11

1 Answers1

0

You can look at the various options available for shimming modules, specifically the exports-loader.

This will bind the global to a module scope and it won't be overwriteable outside of Webpack's runtime.

Filip Dupanović
  • 32,650
  • 13
  • 84
  • 114