How to use package that uses redux-saga as dependency when its in webpack externals?
Hi, I'm having difficulty building a project for Node.js via webpack.
In my case in the project I use my own package that uses redux-saga as dependency
In webpack I specified that my package should be included in the bundle via webpack-node-externals allowList option.
After build and run app in Node.js it crashes with error exactly in the place where my package uses redux-saga, at this place error is: createSagaMiddleware is not a function
I see that CJS and ESM versions of redux-saga is different because if i just copy code that uses redux-saga from my package to project - it will works fine
Repro
I prepare repo with exmaple of issue: https://github.com/krutoo/webpack-externals-breaks-isomorph
just install dependencies and run npx webpack watch --mode=development
Details
If you remove allowlist then build will works correctly
But with allowlist bundle start to use CJS version of redux-saga
In this case it try to call result of require('redux-saga') but in CJS it is not a function
Question
How can solve this problem if i need to add my package to externals but it breaks bundle
Source: redux-saga/redux-saga