-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browserify cannot handle variable requires #2
Comments
Hi, I'm not familiar with brwoserify, what's your advice? |
Something like this should work, but I've never really encountered a problem like this. A bit of researching should be done to get to the best solution.
|
@MatissJanis I've tried your solution, but if somebody only need a simple seenreq in memory, the redis dependency shouldn't be installed, in this case I require the module dynamically. do you have any idea to avoid that? |
Think this is related? I get this error when compiling Webpack:
|
@nathantbaker Are you using browserify ? |
No but Webpack modularizes code similar to browserfy and can uses commonJS require/export functionality: https://webpack.github.io/docs/commonjs.html |
You could probably change this:
to something like this:
|
Or maybe it requires some try-catch, I'm not that familiar with Webpack. |
@andeersg I see, let me do it . Or can you open a pull request? |
Please try the 1.0.0 version to see if it works. |
Essentially browserify cannot handle & analyze structure like this. Generally it is considered a bad approach to use variable requires.
The text was updated successfully, but these errors were encountered: