Coder Social home page Coder Social logo

Comments (7)

SGrondin avatar SGrondin commented on May 17, 2024 1

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.

JamieWritesCode avatar JamieWritesCode commented on May 17, 2024

Looking deeper, this might be a Typescript issue, importing into Angular.

from bottleneck.

SGrondin avatar SGrondin commented on May 17, 2024

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.

SGrondin avatar SGrondin commented on May 17, 2024

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.

SGrondin avatar SGrondin commented on May 17, 2024

Version 2.2.0 has been released, which should eliminate this issue.

from bottleneck.

JamieWritesCode avatar JamieWritesCode commented on May 17, 2024

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.

SGrondin avatar SGrondin commented on May 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.