![]() So what I want is to automatically run cross-env NODE_ENV=development electron dist/main.js after I run serve Vue task and the dev server has been started. While developing, instead of using yarn encore dev -watch, you can use the webpack-dev-server: This builds and serves the front-end assets from a new server. ![]() (I also know that this feature is already implemented in vue-cli-plugin-electron-builder but I’m avoiding all these plugins for multiple reasons) Answer In this case, we need to mock the response and serve it via dummy server, either local or remote. This server runs at localhost:8080 by default, meaning your build assets are available at localhost:8080/build. With Webpack this can be achieved without any dummy server. Webpack devserver allows custom handlers which can be used to serve the API response. This is how I ended up doing it and managed to create a build tool called Vuelectro. Vue JS: Simultaneously Running Express and Webpack Dev Server One stumbling block when I first started using Vue was figuring out how to run a Node server in the same project as an application. I had to do it programmatically using the module and manually start the serve process where I could run electron once the webpack dev server was started. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
June 2023
Categories |