What should i do for imports Inside of my Express server inside Electron


Hello i want to build an application with Electron and Express js as back-end but when i want to import Express to my Electron app, it gives me error that i can’t use import inside of my Express files. But im using Babel for Express. What should i do?

Electron main.js:

const { app, BrowserWindow } = require('electron');

const server = require('./app');

let mainWindow;

app.on('ready', () => {
  mainWindow = new BrowserWindow({
    webPreferences: {
      nodeIntegration: true
    }
  });
  mainWindow.loadURL('https://loaclhost:3500');
});

express app.js:

import express from 'express';
import { ApolloServer } from 'apollo-server-express';
import { typeDefs } from './typeDefs';
import { resolvers } from './resolvers';

const app = express();
const endpoint = `http://localhost:3600/graphql`;
const SERVER = new ApolloServer({
  typeDefs,
  resolvers,
  engine: {
    debugPrintReports: true
  },
  playground: {
    endpoint,
    settings: {
      'editor.theme': 'dark'
    }
  }
});

SERVER.applyMiddleware({
  app
});

const PORT = process.env.PORT || 3500;

app.listen(PORT, () => {
  console.log(`Server ready at port ${endpoint}`);
});