liady / webpack-node-externals

Easily exclude node modules in Webpack
MIT License
1.3k stars 62 forks source link

whitelist regex/string question #33

Closed chrisblossom closed 7 years ago

chrisblossom commented 7 years ago

I've recently found an issue with a different library that required the library to be included with the webpack build. I was unable to use the exact string syntax, but instead needed a regex to work.

Any thoughts of what could be the cause of this?

https://github.com/faceyspacey/react-universal-component/issues/3#issuecomment-307667250

liady commented 7 years ago

@chrisblossom Using a string in the whitelist array triggers an exact comparison of the required path. Meaning that setting myModule in the list won't whitelist myModule/subModule.

If in your case you needed react-universal-component/* to be whitelisted, indeed the regex /^react-universal-component/ is the correct way to whitelist it.

chrisblossom commented 7 years ago

Thank you for your quick response!