sorry, I have no idea what the error can be, seems related to redis custom commands. But why are you using webpack? you should be fine just using the typescript compiler directly...
I develop a vue application with server-side rendering and for me there is only one way to be sure that client and server parts compiles the same way. Sure, I can build client part with webpack and run server part directly (using ts-node etc) but then I lose all webpack settings such as DefinePlugin, resolve.alias, also there was some problems with importing etc. I played with it some time ago and got one working way - to compile both parts with webpack. And this issue is the first problem because of this.
But why are you using webpack? you should be fine just using the typescript compiler directly...
@manast Hot Module Reloading
Why did you add a cannot reproduce label and closed this issue? The OP is providing a reproduction repository. I am also experiencing this issue in a setup with webpack and bull.
I digged into it a bit deeper and the issue is that __dirname is used which will be different because webpack has a different behaviour. There are multiple solutions to this problem:
__dirnamebabel.macros, but it seems like this project is not using babel)__dirname with the correct path with webpack@aliksend I did the latter with the string-replace-loader:
webpack.config.js
const path = require("path");
module.exports = {
...yourConfig,
module: {
rules: [
{
test: /node_modules\/bull\/lib\/commands\/index\.js$/,
use: {
loader: "string-replace-loader",
options: {
search: "__dirname",
replace: `"${path.dirname(require.resolve("bull"))}/lib/commands"`
}
}
}
]
}
};
I encountered the same issue when using serverless-webpack. I am attempting to add a job to queue via a lambda in a Serverless framework setup.
The solution mentioned by @n1ru4l works. Hopefully, we can find a way to make it work without this fix.
@n1ru4l solution works for me. Thanks!
@n1ru4l solution also worked for me, thanks.
This is a duplicate of #920
None of the solutions I saw posted worked for me. However, I was able to get this working by changing the __dirname resolution behavior:
node: {
// required for __dirname to properly resolve
// Also required for `bull` to work, see https://github.com/OptimalBits/bull/issues/811
__dirname: true,
},
@n1ru4l's solution works only if bundle is near node_modules. I'm configuring flow with tiny docker images and single bundle for my nestjs app in nx workspace.
So I just put lua files at same folder with my main.js. This looks like not so cool workaround but it is quick and effitiend in this case.
Here is example:
// angular.json
["app.architect.build.options.assets"]: [
"apps/routing-worker/src/assets",
{
"glob": "**/*.lua",
"input": "node_modules/bull/lib/commands",
"output": "./"
}
]
You can place everywhere you prefer by changing output and using @n1ru4l's solution to replace __dirname.
Most helpful comment
@manast Hot Module Reloading
Why did you add a cannot reproduce label and closed this issue? The OP is providing a reproduction repository. I am also experiencing this issue in a setup with webpack and bull.
I digged into it a bit deeper and the issue is that
__dirnameis used which will be different because webpack has a different behaviour. There are multiple solutions to this problem:__dirnamebabel.macros, but it seems like this project is not using babel)__dirnamewith the correct path with webpack@aliksend I did the latter with the string-replace-loader:
webpack.config.js