add main.tsx
This commit is contained in:
1 parent
09719f7788
commit
ebbae1ae79
5 files changed
+931
-35
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { app, BrowserWindow, Menu, MenuItem, dialog } from 'electron';
|
||||
|
||||
let mainWindow: BrowserWindow = null;
|
||||
let createWindow = function () {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
// nodeIntegration: true
|
||||
}
|
||||
// fullscreenable:false,
|
||||
// maximizable:false
|
||||
})
|
||||
mainWindow.webContents.openDevTools()
|
||||
mainWindow.loadFile('index.html')
|
||||
mainWindow.on('closed', function () {
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
app.on('ready', createWindow)
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (mainWindow === null) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
Generated
+883
-29
File diff suppressed because it is too large.
Load diff
+7
-3
@@ -2,9 +2,11 @@
|
||||
"name": "behavior3editor",
|
||||
"version": "0.0.1",
|
||||
"description": "行为树编辑器",
|
||||
"main": "index.js",
|
||||
"main": "./dist/main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"prestart": "webpack --config webpack.common.config.js",
|
||||
"start": "electron ."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -20,11 +22,13 @@
|
||||
"source-map-loader": "^1.1.0",
|
||||
"ts-loader": "^8.0.4",
|
||||
"typescript": "^4.0.3",
|
||||
"webpack": "^4.44.2"
|
||||
"webpack": "^4.44.2",
|
||||
"webpack-cli": "^3.3.12"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/react": "^16.9.51",
|
||||
"@types/react-dom": "^16.9.8",
|
||||
"electron": "^10.1.3",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1"
|
||||
}
|
||||
|
||||
+2
-1
@@ -8,7 +8,8 @@
|
||||
"jsx": "react"
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*"
|
||||
"./src/**/*",
|
||||
"main.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
module.exports = {
|
||||
entry: "./src/index.tsx",
|
||||
mode: "development",
|
||||
entry: {
|
||||
"bundle": ["./src/index.tsx"],
|
||||
"main": ["./main.tsx"]
|
||||
},
|
||||
output: {
|
||||
filename: "bundle.js",
|
||||
filename: "[name].js",
|
||||
path: __dirname + "/dist"
|
||||
},
|
||||
|
||||
@@ -21,4 +25,6 @@ module.exports = {
|
||||
|
||||
plugins: [
|
||||
],
|
||||
|
||||
target: "electron-renderer"
|
||||
};
|
||||
Reference in new issue
Block a user