#Nest can't resolve socket module

11 messages · Page 1 of 1 (latest)

arctic drift
#

I get this error when I run yarn start:dev script, I'm not using sockets in my project, and importing of this module is optional, but it shows the next message ( see attached image )

Nest Core version "^9.0.0"

fringe jolt
#

Usually this is an error from webpack not ignoring the optional module. So you have a webpack config being used anywhere?

arctic drift
#

yes indeed this is the detail of the script command:

nest build --webpack --webpackPath webpack-hmr.config.js --watch

#

can i disable these errors?

fringe jolt
#

Can you show your webpack config?

arctic drift
#

`const nodeExternals = require('webpack-node-externals');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');

module.exports = function (options, webpack) {
return {
...options,
entry: ['webpack/hot/poll?100', options.entry],
externals: [
nodeExternals({
allowlist: ['webpack/hot/poll?100'],
}),
],
plugins: [
...options.plugins,
new webpack.HotModuleReplacementPlugin(),
new webpack.WatchIgnorePlugin({
paths: [/.js$/, /.d.ts$/],
}),
new RunScriptWebpackPlugin({
name: options.output.filename,
autoRestart: false,
}),
],
};
};
`

#

i'm using lerna ( multi package tool )

fringe jolt
#

Let me double check nest's default webpack options and see what's missing here

#

Actually, I don't see where that error is pointing to. @nestjs/core's index.ts doesn't import from @nestjs/websockets

#

Well, it does optionally require it