JWally / jsLPSolver

Simple OOP javaScript library to solve linear programs, and mixed integer linear programs
The Unlicense
420 stars 69 forks source link

Webpack IgnorePlugin setting #102

Open darrenklein opened 4 years ago

darrenklein commented 4 years ago

Hello, thank you so much for all of your hard work on this amazing module! I just wanted to report a possible issue in your README documentation, regarding setting the Webpack IgnorePlugin.

The documentation shows that it should be added like so:

"plugins": [
    new webpack.IgnorePlugin(/(fs|child_process)/)
]

but when I did this, I found that it caused other problems with my app. Specifically, I was getting errors in the browser console like:

Uncaught Error: Cannot find module "./offset"

(that's related to a different Node module in my project, it has nothing directly to do with this module)

After a good deal of experimenting, I found that I was able to resolve this issue by providing slightly different formatting for the `IgnorePlugin:

"plugins": [
    new Webpack.IgnorePlugin(new RegExp("^(fs|child_process)$"))
]

and then all worked well - fs and child_process were handled correctly, and no errors with any of my other modules.

In my case, I'm using a rather old version of Webpack, version 3.11.0 - I'm not sure offhand how much a role that may be playing, but wanted to document this here to get your thoughts and possibly help others striking the same issue.

Cheers!