electronの学習中です。
レンダラープロセスのrequireを使ってvueを使えるのでしょうか?
試してみたのですが以下のエラーになってしまいました。
windows10
Electron 6.0.3
Chorome
Error
1[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build. 2(found in <Root>)
// index.js const { ipcRenderer } = require('electron'); const remote = require('electron').remote; const Vue = require('vue'); // const Vue = remote.require('vue'); var app = new Vue({ el: '#main', data: { message: "hello" }, })
// main.js const electron = require('electron'); const app = electron.app; const BrowserWindow = electron.BrowserWindow; let mainWindow = null; app.on('ready', () => { mainWindow = new BrowserWindow( { width: 800, height: 600, webPreferences: { nodeIntegration: true } }) mainWindow.loadURL('file://' + __dirname + '/src/public/index.html'); mainWindow.webContents.openDevTools(); mainWindow.on('closed', function() { mainWindow = null; }); });
<--- index.html---> <html> <head> </head> <body> <div id="main"> テスト {{message}} </div> <script src="index.js"></script> </body> </html>
あなたの回答
tips
プレビュー