Electronでパッケージングしても含まれないモジュールがあるのですがなぜなのでしょうか?
含まれないモジュールはcsvモジュールです。
パッケージング時のコマンド
npx electron-packager ./src myapp --platform=win32 --arch=x64 --overwrite
package.json
json
1{ 2 "name": "electron-test", 3 "version": "1.0.0", 4 "description": "", 5 "main": "main.js", 6 "scripts": { 7 "start": "electron .", 8 "test": "echo \"Error: no test specified\" && exit 1" 9 }, 10 "author": "", 11 "license": "ISC", 12 "devDependencies": { 13 "electron": "^6.0.2", 14 "electron-packager": "^14.0.4", 15 "gulp": "^4.0.2" 16 }, 17 "private": true, 18 "dependencies": { 19 "builder": "^4.0.0", 20 "csv": "^5.1.2" 21 } 22} 23
main.js
javascript
1 2const electron = require('electron'); 3const app = electron.app; 4const BrowserWindow = electron.BrowserWindow; 5 6const fs = require('fs'); 7const csv = require('csv'); 8 9let mainWindow = null; 10app.on('ready', () => { 11 12 // mainWindowを作成(windowの大きさや、Kioskモードにするかどうかなどもここで定義できる) 13 mainWindow = new BrowserWindow({ 14 width: 800, 15 height: 800, 16 autoHideMenuBar: true // メニューバーを隠す 17 }) 18 19 // Electronに表示するhtmlを絶対パスで指定(相対パスだと動かない) 20 mainWindow.loadURL('file://' + __dirname + '/index.html'); 21 22 // ChromiumのDevツールを開く 23 mainWindow.webContents.openDevTools(); 24 25 mainWindow.on('closed', function() { 26 mainWindow = null; 27 }); 28});
あなたの回答
tips
プレビュー