Skip to content

Instantly share code, notes, and snippets.

View gdonega's full-sized avatar
🐈

Gustavo Donegá Queiroz gdonega

🐈
  • Brasil, São Paulo
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<h1>Hello World!</h1>
<h1>Hello World!</h1>
const path = require("path");
module.exports = {
target: "web", // O nosso aplicativo pode rodar sem o Electron
entry: [path.join(__dirname, '../../../src/vue.main.js')], // O arquivo de entrada para a nossa aplicação; Esses pontos de entrada podem ser nomeados e também podemos ter vários deles, caso queira dividir o "webpack bundle" em arquivos menores para aumentar a velocidade de carregamento dos scripts entre as várias paginas do nosso app
output: {
path: path.resolve(__dirname, "../../../../dist/webpack/vue"), // Onde todos os arquivos de saída do webpack serão colocados
filename: "bundle.js" // O nome do webpack bundle que será gerado
},
module: {
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const merge = require("webpack-merge");
const base = require("./base");
const path = require("path");
const { VueLoaderPlugin } = require('vue-loader')
module.exports = merge(base, {
mode: "development",
devtool: "source-map", // Mostar o source-map, permitindo o debug
<template>
<div id="app">
<h1>Bem vindo ao Vue.js</h1>
</div>
</template>
<script>
export default {
name: "app",
}
import Vue from 'vue'
import App from './VueApp.vue'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
render: h => h(App)
}).$mount('#app')
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
</head>
<body>
<div id="app"></div>
</body>
</html>
const { app, BrowserWindow } = require('electron')
const port = 40992; // Deve ser a mesma porta do Servidor Vue.js (webpack de desenvolvimento): no arquivo que está em app/config/vue/webpacks/dev.js (partindo da raiz do projeto)
const selfHost = `http://localhost:${port}`;
function createWindow () {
// Cria uma janela de navegação.
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
{
"name": "electron-with-vue",
"version": "1.0.0",
"description": "A base Electron project using Vue.js",
"main": "app.main.js",
"scripts": {
"dev-electron-start-app": "cross-env NODE_ENV=development electron .",
"dev-vue-start-server": "cross-env NODE_ENV=development webpack-dev-server --config ./app/config/vue/webpacks/dev.js",
"dev": "concurrently \"npm run dev-vue-start-server\" \"npm run dev-electron-start-app\" -k"
},
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const merge = require("webpack-merge");
const base = require("./base");
const path = require("path");
const { VueLoaderPlugin } = require('vue-loader')
module.exports = merge(base, {
mode: "production",
devtool: "nosources-source-map",
/*
Reasonably Secure Electron
Copyright (C) 2019 Bishop Fox
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the