Reputation: 101
I am writing a javascript REPL that is intended to run in the browser and execute nodejs crypto functions. My project is in ReactJS and I am using webpack to bundle all the modules and dependencies together. I am trying to include the builtin node crypto module in the bundle file produced by webpack and I am unable to do so. Webpack seems to replace the builtin crypto module with the crypto-browserify
using the NodeSourcePlugin
plugin and the node-libs-browser
package. When I disable these checks I get an error during the compilation process complaining that the crypto module cannot be resolved.
Is there a way to circumvent this behavior and include the nodejs crypto javascript code? Or is there something inherent about the crypto library that prohibits it from being included.
I tried using webpack.ProvidePlugin
to require the node crypto module at compile time and then assigning it explicitly but that didn't work.
My webpack config was generated by ReactJS. It is too long to include but it should be pretty boilerplate.
Upvotes: 9
Views: 15598