Skip to content
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

Multiple versions of polka can't play nice #211

Open
43081j opened this issue Jul 29, 2024 · 0 comments
Open

Multiple versions of polka can't play nice #211

43081j opened this issue Jul 29, 2024 · 0 comments

Comments

@43081j
Copy link

43081j commented Jul 29, 2024

In some cases, you may end up with something like this:

import {someApp} from 'wherever'; // Assume this package bundles polka, so it has its own copy
import polka from 'polka';

const server = polka();
const app = someApp();

app.server; // a Polka instance

server.use(app.server); // error since `!(app.server instanceof Polka)`

you shouldn't run into this often since your package manager would usually de-dupe and you'd have a single polka version

however, its very possible something you depend on which consumes polka instances (or any polka types) is pinned to an older 1.x than you are for example.

to solve this, maybe instead of base instanceof Polka, we can brand the class and check for that instead (some sort of _$polkaVersion or something, so we can also only consume same-major instances)

} else if (typeof base === 'function' || base instanceof Polka) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant