I'm receiving the following error after npm run build
.
The build goes fine, then I launch the following prompt and receiving this error (both windows or ubuntu, node v18)
npm start
> node dist/server/main.mjs
file:///C:/Users/andre/Documents/GitHub/Andrea%20Corriga/Mmorpg/dist/server/main.mjs:4
import mongoose, { Schema, models, model } from "mongoose";
^^^^^^
SyntaxError: Named export 'models' not found. The requested module 'mongoose' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'mongoose';
What can be?
Also: Is it possible to modify the connection parameters to the server? If I wanted to separate the client and server, how could I configure the client to point to a server IP different from localhost?