sindresorhus / any-observable

Support any Observable library and polyfill
MIT License
70 stars 12 forks source link

[Bug] Please move rxjs dependency from dev to prod #21

Closed SoyYoRafa closed 5 years ago

SoyYoRafa commented 5 years ago

Hi,

rxjs is required by any-observable during runtime. It is in devDependencies but should be in dependencies. Could you please make the change? This is causing issues when this library is installed by pnpm. We have a workaround to patch your package.json but ideally we would like to remove it.

Thank you in advanced, -Rafael

sindresorhus commented 5 years ago

Please read the docs on what this package does. It's up to you to provide the Observable implementation you want to use. This is just a compatibility layer.

clemyan commented 5 years ago

This is actually due to the non-flat/strict node_modules structure created by pnpm (and also by Yarn PnP), so rxjs is not inside any-observable's node_modules even if an ancestor module (e.g. listr) list it as a dep.

The solution is to declare rxjs and zen-observable as optional peer deps, which is supported by Yarn since 1.13.0 and (as far as I know) will be supported by pnpm 3.2

{
    "peerDependencies": {
        "rxjs": "*", // Or whatever version you support
        "zen-observable": "*",
    },
    "peerDependenciesMeta": {
        "rxjs": {
            "optional": true
        },
        "zen-observable": {
            "optional": true
        },
    }
}