Comments (7)
EDIT: Bottleneck is now obfuscating its require call to prevent build tools from trying to inline redis.
Hi, this is definitely an issue with your build process.
The redis
module is only imported within the RedisStorage
constructor, which means Bottleneck only attempts to require
that module when Clustering is enabled.
But I'm still pretty sure I know what issue you're running into with your build:
You need to tell whatever packaging tool you use to ignore the redis
module. If you're using Browserify, you need to pass it the -u redis
option. Packaging tools read the source code and find all the places where modules are required, then go read those modules and so on. Whichever packaging system you're using will definitely let you ignore certain modules.
from bottleneck.
Looking deeper, this might be a Typescript issue, importing into Angular.
from bottleneck.
Here's Bottleneck's own build script
Bottleneck uses Browserify to provide a pre-made frontend bundle to be used by browsers. Nodejs users still require() Bottleneck as usual.
By the way, I've been seriously considering obfuscating the require('redis')
line to hide it from packagers without affecting Clustering users.
from bottleneck.
The upcoming 2.2.0
release will be released this week. It contains a change that solves your issue without requiring you to ignore modules (as you should).
To be clear, it's normal and expected of you as an Angular/Webpack/Browserify/etc user to have to exclude modules sometimes, but if I, as a module author, can make your life easier without too much trouble, then I'll do it.
from bottleneck.
Version 2.2.0
has been released, which should eliminate this issue.
from bottleneck.
Hey, thanks Simon. Apologies for not getting back to you on this one, I simply reverted to v1 at the time and didn't get a chance to revisit yet.
I have no doubt you are 100% right about the simple exclusion, but I appreciate your effort to update the package regardless. Looking forward to giving the new version a spin.
from bottleneck.
No worries! I hope v2 works great for you.
I was being extra clear in my previous message for those landing on this page from Googling a generic error like Module not found: Error: Can't resolve 'redis'
.
from bottleneck.
Related Issues (20)
- Invalid job status RECEIVED, expected DONE HOT 1
- task.apply is not a function
- Any correct ways to do rate limit 1000 per hour?
- `light.d.ts` not published in npm package
- Throw error for invalid settings
- Would it be possible to add a reset() method to clear state on local instances? HOT 1
- ReplyError: ERR SETTINGS_KEY_NOT_FOUND when use in Clustering mode with Redis 7.x HOT 8
- Is bottleneck still maintained? HOT 11
- recovering for a crashed service using redis
- bottleneck lost tracing data when using reservoir options
- Redis errors with ReplyError: ERR UNKOWN_CLIENT HOT 7
- dynamic schedule / retry HOT 3
- Long delay in Bottleneck.schedule execution in a distributed env HOT 1
- Is there a way to pass different options for limiters within the same group?
- Is there a way to read and write the reservoir for a given limiter?
- Long-lasting limiters with matching cardinality to app's users
- ERR SETTINGS_KEY_NOT_FOUND with redis 7.0.7 HOT 11
- user_script:201: attempt to compare number with nil
- Warning from vite about using eval
- Retry behaviour
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bottleneck.