A
A
Alexey2017-06-18 15:16:19
Node.js
Alexey, 2017-06-18 15:16:19

Cannot find module "." Issue in node.js compilation?

The problem is compiling node.js with webpack.
I'm using typescript.
Import: Call:
import * as socketIo from "socket.io";

private sockets(): void {
        this.io = socketIo(this.server);
    }

Gives an error message:
return /*require.resolve*/(!(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
                                                                                                                                               ^

Error: Cannot find module "."

What could it be and how can I diagnose the error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2017-06-19
@azovl

So the solution is:

let nodeExternals = require('webpack-node-externals');
...
let serverConfig = {
       externals: [nodeExternals()],
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question