Add electron entry #40
@ -80,7 +80,11 @@ const Entry = () => ({
|
|||||||
ServiceRunner: {
|
ServiceRunner: {
|
||||||
import: source("./Service/Runner.ts"),
|
import: source("./Service/Runner.ts"),
|
||||||
dependOn: ["Service"]
|
dependOn: ["Service"]
|
||||||
}
|
},
|
||||||
|
|
||||||
|
Electron: {
|
||||||
|
import: source("./Electron/Electron.ts")
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
43
config/webpack.electron.js
Normal file
43
config/webpack.electron.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
const { Entry, Output, resolve, TypeScriptRules } = require("./webpack.common");
|
||||||
|
const nodeExternals = require("webpack-node-externals");
|
||||||
|
|
||||||
|
const AllEntry = Entry();
|
||||||
|
|
||||||
|
module.exports = (env) => {
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
|
||||||
|
entry: {
|
||||||
|
Electron: AllEntry.Electron,
|
||||||
|
},
|
||||||
|
|
||||||
|
output: Output("[name].js"),
|
||||||
|
devtool: 'source-map',
|
||||||
|
mode: "development",
|
||||||
|
resolve: resolve(),
|
||||||
|
|
||||||
|
optimization: {
|
||||||
|
splitChunks: {
|
||||||
|
chunks: 'all',
|
||||||
|
minSize: 1000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
externals: [nodeExternals()],
|
||||||
|
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
TypeScriptRules()
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
node: {
|
||||||
|
__filename: false,
|
||||||
|
__dirname: false
|
||||||
|
},
|
||||||
|
|
||||||
|
target: 'node'
|
||||||
|
};
|
||||||
|
|
||||||
|
return config;
|
||||||
|
};
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -35,7 +35,8 @@
|
|||||||
"typescript": "^4.5.4",
|
"typescript": "^4.5.4",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.65.0",
|
||||||
"webpack-cli": "^4.9.1",
|
"webpack-cli": "^4.9.1",
|
||||||
"webpack-dev-server": "^4.7.2"
|
"webpack-dev-server": "^4.7.2",
|
||||||
|
"webpack-node-externals": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@atao60/fse-cli": {
|
"node_modules/@atao60/fse-cli": {
|
||||||
@ -7904,6 +7905,15 @@
|
|||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/webpack-node-externals": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/webpack-sources": {
|
"node_modules/webpack-sources": {
|
||||||
"version": "3.2.3",
|
"version": "3.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
||||||
@ -14352,6 +14362,12 @@
|
|||||||
"wildcard": "^2.0.0"
|
"wildcard": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"webpack-node-externals": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"webpack-sources": {
|
"webpack-sources": {
|
||||||
"version": "3.2.3",
|
"version": "3.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
"build-run-desktop-web": "npm run build-desktop-web & npm run copy-fluent-icon & npm run build-service & npm run run-service",
|
"build-run-desktop-web": "npm run build-desktop-web & npm run copy-fluent-icon & npm run build-service & npm run run-service",
|
||||||
"release-run-desktop-web": "npm run release-desktop-web & npm run copy-fluent-icon & npm run release-service & npm run run-service",
|
"release-run-desktop-web": "npm run release-desktop-web & npm run copy-fluent-icon & npm run release-service & npm run run-service",
|
||||||
"skip-electron-ci": "set ELECTRON_SKIP_BINARY_DOWNLOAD=1& npm ci",
|
"skip-electron-ci": "set ELECTRON_SKIP_BINARY_DOWNLOAD=1& npm ci",
|
||||||
|
"build-electron": "webpack --mode development --config ./config/webpack.electron.js",
|
||||||
|
"release-electron": "webpack --mode production --no-devtool --config ./config/webpack.electron.js",
|
||||||
"electron-cache": "set ELECTRON_SKIP_BINARY_DOWNLOAD=& set ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/& set ELECTRON_CUSTOM_DIR={{ version }}& node ./node_modules/electron/install.js",
|
"electron-cache": "set ELECTRON_SKIP_BINARY_DOWNLOAD=& set ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/& set ELECTRON_CUSTOM_DIR={{ version }}& node ./node_modules/electron/install.js",
|
||||||
"electron-test": "electron"
|
"electron-test": "electron"
|
||||||
},
|
},
|
||||||
@ -51,7 +53,8 @@
|
|||||||
"typescript": "^4.5.4",
|
"typescript": "^4.5.4",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.65.0",
|
||||||
"webpack-cli": "^4.9.1",
|
"webpack-cli": "^4.9.1",
|
||||||
"webpack-dev-server": "^4.7.2"
|
"webpack-dev-server": "^4.7.2",
|
||||||
|
"webpack-node-externals": "^3.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fluentui/react": "^8.56.0",
|
"@fluentui/react": "^8.56.0",
|
||||||
|
16
source/Electron/Electron.ts
Normal file
16
source/Electron/Electron.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { app, BrowserWindow } from "electron";
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
|
||||||
|
await app.whenReady();
|
||||||
|
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600
|
||||||
|
});
|
||||||
|
|
||||||
|
win.loadURL("https://www.baidu.com");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
@ -43,7 +43,10 @@
|
|||||||
],
|
],
|
||||||
"@Service/*": [
|
"@Service/*": [
|
||||||
"./source/Service/*"
|
"./source/Service/*"
|
||||||
]
|
],
|
||||||
|
"@Electron/*": [
|
||||||
|
"./source/Electron/*"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
Loading…
Reference in New Issue
Block a user