I'm trying to build a project using:
My objective is to have an Electron packaged app with strapi server inside it serving this react free template.
So I'm totally confused about putting these tools together. Each one has your webpackage, dev server, build process, etc...
I know there's no easy recipe for this, but is there any way or tip to help me on this, or just a direction?
I did that, it is possible to do, but i still have somethings not figured-out like this one
So to achieve your objective this needs to be in your electron index.js file, You need to build the front-end, and paste the output from the build process into your public folder of strapi.
Also you need to copy package.json with (api, assets, build, config, db, extensions, public) folders from your strapi project into the packaged electron app folder (beside the exe file).
I know it is old question but i thought it might help someone.
function createWindow() {
// Create the browser window.
const win = new BrowserWindow({
maximizable: true,
title: "Dental System",
webPreferences: {
nodeIntegration: true
}
})
win.maximize();
strapi().start().then(() => {
win.loadURL('http://localhost:1337/');
}).catch((e) => {
console.log(e);
});
win.on('closed', () => {
app.quit();
})
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})