cawa-93 / vite-electron-builder Goto Github PK
View Code? Open in Web Editor NEWSecure boilerplate for Electron app based on Vite. TypeScript + Vue/React/Angular/Svelte/Vanilla
License: MIT License
Secure boilerplate for Electron app based on Vite. TypeScript + Vue/React/Angular/Svelte/Vanilla
License: MIT License
I want do some unit test for vue code. Is it possible to use jest to test vue alone?
Describe the bug
First: Why I'm filing this bug here. As a new-to-Vue user, I wasn't sure what in the world was going on here. I was unfamiliar with Vetur and I had to spend some time debugging the issue. While it's arguable that this is a problem with Vetur, it's definitely a distraction from getting started with Vue-in-electron fun, and I think it would be a good idea for this project to shield new users from errors unrelated to the content of the project. I think I'd recommend commenting out that line in the vetur config. (It might even be nice for new users if there was some comment documenting what in the world the Vetur config is, and/or what they should know about it)
With a fresh clone of this repo, using the latest VS Code and the latest Vetur extension (at the time of the writing). I'm getting a TON of errors (aka "red squigglies") until I disable the experimental template interpolation.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No errors in the IDE.
Additional context
Workaround
For now, simply commenting out 'vetur.experimental.templateInterpolationService': true
and running the VS Code command Vetur: Restart VLS
will resolve the issue. However, I don't get types in the template.
This issue contains a list of Renovate updates and their statuses.
This repository currently has no open or pending branches.
after doing a clean download, all the commands run to completion. But i fail to get any electron window to open.
please help
What did I do wrong
Hi,
Besides this template, do you have any article, for example, blog article to explain how this template is built up step-by-step?
Thanks,
Fei
I tried to use https://github.com/sindresorhus/electron-store, but it reported an error.
preload/index.ts
import * as Store from 'electron-store';
const api = {
getStore: () => new Store(),
}
some.vue
import { useElectron } from '@/use/electron';
const { getAppPath,getstore} = useElectron();
console.log(getstore()); // Then report an error
Hey i'm try to use a icon fot the system tray but the bundle is not copyng the asset, i already look on the vite config but none so far work.
Could you share some example of how use static assets for icons tray and window
Testing applications with Spectron is quite painful. Also Spectron currently has no active maintainers.
I want to give it up. Possible alternatives:
Describe the bug
TypeError: Cannot read properties of undefined (reading 'requestSingleInstanceLock')
To Reproduce
Steps to reproduce the behavior:
下午1:45:04 [main] /workspace/normojs/korvo-browser/packages/main/dist/index.cjs:27 const isSingleInstance = require$$1.app.requestSingleInstanceLock(); TypeError: Cannot read properties of undefined (reading 'requestSingleInstanceLock')
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Cannot find preset's package (:onlyNpm)
Describe the bug
npm run watch
produces the following warnings when running after cloning this template and installing deps:
> watch
> node scripts/watch.js
14:27:18 [main] (node:68741) ExtensionLoadWarning: Warnings loading extension at /Users/uninen/Library/Application Support/vite-electron-template/extensions/ljjemllljcmogpfapbkkighbhhppjdbg:
Unrecognized manifest key 'browser_action'.
Unrecognized manifest key 'update_url'.
Permission 'contextMenus' is unknown or URL pattern is malformed.
Cannot load extension with file or directory name _metadata. Filenames starting with "_" are reserved for use by the system.
(Use `Electron --trace-warnings ...` to show where the warning was created)
To Reproduce
Steps to reproduce the behavior:
npm install
npm run watch
Expected behavior
No warnings.
Describe the bug
npm run watch
failed with window is undefined
after add @koa/router
, caused by any-promise
package.
Vite seems only designed to bundle code for browser, so it uses browser
field of package.json
, and i found no way to disable this behavior.
To Reproduce
Steps to reproduce the behavior:
npm install koa @koa/router @types/koa @types/koa__router
npm run watch
Expected behavior
any-promise register-shim.js
should not included in bundle because it has been marked for browser only.
Screenshots
If applicable, add screenshots to help explain your problem.
PS D:\~\src\github.com\cawa-93\vite-electron-builder> npm run watch
> watch
> node scripts/watch.js
下午9:48:44 [main] App threw an error during load
下午9:48:44 [main] ReferenceError: window is not defined
at Object.<anonymous> (D:\~\src\github.com\cawa-93\vite-electron-builder\packages\main\dist\index.js:14474:27)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at Module._load (internal/modules/cjs/loader.js:776:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12684)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (D:\~\src\github.com\cawa-93\vite-electron-builder\packages\main\dist\index.cjs:2:1)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
Additional context
I searched about bundle for node with vite/rollup, but not found anything useful,
maybe we should use esbuild for main/preload code directly?
Describe the bug
When running in development mode the sourcemaps are multiplied, resulting errors during debug
To Reproduce
Steps to reproduce the behavior:
npm run watch
5:01:31 PM [main] [20564:0818/170131.504:ERROR:CONSOLE(1)] "Could not load content for http://localhost:3000/src/components/C:/B/packages/renderer/src/components/About.vue (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)", source: devtools://devtools/bundled/core/sdk/sdk.js (1)
Please note the weird concatenated link.
I'm using Windows 10 and VS Code attaching debugger to the renderer process
It is also causing problems when I try to debug the renderer process, and the breakpoints are being hit, but the lines are off.
I'm not sure whether this is a vite issue or a local config problem, I have a hunch it might be related to the way how alias resolve is working, but I might be totally wrong
Expected behavior
Have all sources appear once in a source tree
Describe the bug
Platform(Mac os)
I tried to access the Electron Menu in the render script.I used the preload for that. so i tried to import the menu from the electron api. but it was empty when i log it with in the preload script itself.
Next i tired to enable the remoteModule in the webprefrence, and tried to access the menu in the preload from remote.when i console it it showing the menu init, but when i tried to pass that to render script and console it in the render, its still don't have the menu . I tried to console log remote in the render script but it has only minimum methods only. and Menu was not there.
Below is the image which shows when i console. the remote. from render script.
Below is the image that i consoled from the preload script which consist all the methods , when i tried to pass the menu only from the preload script to render script still its not working. showing menu is undefined
Describe the bug
Getting the error shown below on launch.
I found the cause - it happens if the project path contains spaces. Not sure how to resolve the issue though. I guess Vite cannot resolve non-encoded URLs containing characters like %20
[vite] Internal server error: The request url "E:/vite%20electron/vite-electron-builder/node_modules/.vite/vue.js.map" is outside of Vite serving allow list:
- /E:/vite electron/vite-electron-builder
Refer to docs https://vitejs.dev/config/#server-fs-allow for configurations and more details.
at ensureServingAccess (E:\vite electron\vite-electron-builder\node_modules\vite\dist\node\chunks\dep-24231913.js:64798:15)
at viteServeRawFsMiddleware (E:\vite electron\vite-electron-builder\node_modules\vite\dist\node\chunks\dep-24231913.js:64765:13)
at call (E:\vite electron\vite-electron-builder\node_modules\vite\dist\node\chunks\dep-24231913.js:53749:7)
at next (E:\vite electron\vite-electron-builder\node_modules\vite\dist\node\chunks\dep-24231913.js:53693:5)
at viteTransformMiddleware (E:\vite electron\vite-electron-builder\node_modules\vite\dist\node\chunks\dep-24231913.js:65004:28)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
To Reproduce
Clone repo to path containing spaces:
Describe the bug
We are using the vite-electron-builder
template together with react-native-web
. Building works fine, but the watch script does not work as expected.
Many react-native libs do not use .jsx
as file extension for JSX files, they just use .js
. The metro bundler which is used by react-native is fine with this. For vite we needed to add this config to the renderer:
esbuild: {
loader: 'tsx',
include: [/(src|react-native-.*)\/.*\.[tj]sx?$/],
exclude: [],
},
This way, also .js
files get treated as .jsx
. However, it seems that the watch script is ignoring the packages/renderer/vite.config.js
configuration.
To Reproduce
Steps to reproduce the behavior:
.js
esbuild
config to packages/renderer/vite.config.js
npm run watch
dependabot does not have the ability to update related dependencies in a single OL. In some cases, updating one dependency and not updating another will result in a build error.
For example, you should always remember and update the electron release dependency BEFORE updating the electron dependency to avoid a situation where the collection tries to get information about an electron version that is not already in the electron release.
Describe the bug
When the script compile
is executed, the result tell me failed.
To Reproduce
Steps to reproduce the behavior:
compile
Expected behavior
The script executes successfully and the Setup package file is generated.
Screenshots
D:\repos\electronjs\vite-electron-builder-main>npm run compile
vite-electron-builder@ precompile D:\repos\electronjs\vite-electron-builder-main
cross-env MODE=production npm run build
vite-electron-builder@ build D:\repos\electronjs\vite-electron-builder-main
node scripts/build.js
packages/main/
vite v2.1.2 building for production...
transforming (148) ....\node_modules\balanced-match\index.js 'default' is imported from external module 'util' but never used
✓ 151 modules transformed.
dist/index.cjs 3.02kb / brotli: 1.12kb
dist/index.cjs.map 5.46kb
Bundling time: 2.639s
packages/preload/
vite v2.1.2 building for production...
✓ 1 modules transformed.
dist/index.cjs 0.18kb / brotli: 0.13kb
dist/index.cjs.map 1.46kb
Bundling time: 108.418ms
packages/renderer/
vite v2.1.2 building for production...
✓ 24 modules transformed.
dist/logo.03d6d6da.png 6.69kb
dist/index.html 0.46kb
dist/index.ff4157e8.css 0.26kb / brotli: 0.15kb
dist/About.cb2527ca.js 0.57kb / brotli: 0.32kb
dist/About.cb2527ca.js.map 1.08kb
dist/About.1ce46fba.css 0.07kb / brotli: 0.05kb
dist/index.fb3e6a07.js 2.41kb / brotli: 1.07kb
dist/index.fb3e6a07.js.map 5.67kb
dist/vendor.d30bbbfa.js 64.26kb / brotli: 22.58kb
dist/vendor.d30bbbfa.js.map 629.17kb
Bundling time: 4.559s
Total bundling time: 7.313s
vite-electron-builder@ compile D:\repos\electronjs\vite-electron-builder-main
electron-builder build --config electron-builder.config.js --dir --config.asar=false
• electron-builder version=22.10.5 os=10.0.19042
• loaded configuration file=D:\repos\electronjs\vite-electron-builder-main\electron-builder.config.js
• description is missed in the package.json appPackageFile=D:\repos\electronjs\vite-electron-builder-main\package.json
• author is missed in the package.json appPackageFile=D:\repos\electronjs\vite-electron-builder-main\package.json
• writing effective config file=dist\builder-effective-config.yaml
• packaging platform=win32 arch=x64 electron=12.0.1 appOutDir=dist\win-unpacked
• Unpacking electron zip zipPath=undefined
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
Additional context
Describe the bug
Unable to create an app with transparency
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The app starts normally
Is your feature request related to a problem? Please describe.
pnpm makes a better use of your drive, is faster than npm and results in more predictable behaviors (you cannot use packages not listed in the dependencies because they are not located in node_modules). I have seen a lot of people in the Vue ecosystem starting to use it and since this template is Vue by default I think it makes sense to switch as well.
Describe the solution you'd like
Remove npm lockfile, generate pnpm lockfile and replace all npm instructions with pnpm counterparts (cli is largely the same though)
Additional context
Comparison between npm and pnpm version if this template.
git clone https://github.com/cawa-93/vite-electron-builder.git npm
cd npm
npm install
results in a 580.8 MB directory
git clone https://github.com/cawa-93/vite-electron-builder.git pnpm
cd pnpm
rm package-lock.json
pnpm install
results in a 424.2 kB directory
I know that the space is still used somewhere else, but since those version of required packages can be reused for other node projects the space is utilized in a much better. If you have 2 electron apps based on this template you save 580.1 MB of space (size of node_modules with npm). If you have 3 of them you save 1160.2 MB and so on.
Will make a PR if the author approves.
A minor tweak to not duplicate code for types:
vite-electron-builder/packages/preload/src/index.ts
Lines 7 to 9 in d4d7c73
Becomes:
export const api = {
versions: process.versions,
};
Becomes:
declare interface Window {
electron: Readonly<typeof import('../src/index').api>;
electronRequire?: NodeRequire;
}
Not sure if there are any drawbacks.
the command line has error related to libva, but vite-electron-builder seems work still,
Describe the bug
2021-05-17 16:21:28 ⌚ ming-manjaro in ~/learn/js/vite-electron-builder
± |main U:1 ✗| → npm run watch
> watch
> node scripts/watch.js
下午4:21:36 [main] libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
下午4:21:36 [main] Failed install extension: Error: Version of Electron: 12.0.7 does not match required range >=1.2.1 for extension ljjemllljcmogpfapbkkighbhhppjdbg
at install (/home/ming/learn/js/vite-electron-builder/packages/main/dist/index.js:7873:29)
at /home/ming/learn/js/vite-electron-builder/packages/main/dist/index.cjs:52:100
To Reproduce
Steps to reproduce the behavior:
Expected behavior
no errors
Additional context
my env:
Lib versions
node: v14.16.0
v8: v8.9.255.25-electron.0
uv: v1.40.0
zlib: v1.2.11
brotli: v1.0.9
ares: v1.16.1
modules: v87
nghttp2: v1.41.0
napi: v7
llhttp: v2.1.3
openssl: v1.1.1
icu: v68.1
unicode: v13.0
electron: v12.0.7
chrome: v89.0.4389.128
2021-05-17 16:26:00 ⌚ ming-manjaro in ~/learn/js/vite-electron-builder
± |main U:1 ✗| → node -v
v14.17.0
2021-05-17 16:26:10 ⌚ ming-manjaro in ~/learn/js/vite-electron-builder
± |main U:1 ✗| → npm -v
7.13.0
2021-05-17 16:26:18 ⌚ ming-manjaro in ~/learn/js/vite-electron-builder
± |main U:1 ✗| → screenfetch
██████████████████ ████████ ming@ming-manjaro
██████████████████ ████████ OS: Manjaro 21.0.3 Ornara
██████████████████ ████████ Kernel: x86_64 Linux 5.9.16-1-MANJARO
██████████████████ ████████ Uptime: 9h 13m
████████ ████████ Packages: 1228
████████ ████████ ████████ Shell: bash
████████ ████████ ████████ Resolution: 1920x1080
████████ ████████ ████████ DE: KDE 5.81.0 / Plasma 5.21.4
████████ ████████ ████████ WM: KWin
████████ ████████ ████████ GTK Theme: Breath [GTK2/3]
████████ ████████ ████████ Icon Theme: breath2
████████ ████████ ████████ Disk: 92G / 114G (85%)
████████ ████████ ████████ CPU: AMD Ryzen 7 PRO 4750U with Radeon Graphics @ 12x 1.697GHz
████████ ████████ ████████ GPU: SVGA3D; build
RAM: 7640408064-
2021-05-17 16:26:23 ⌚ ming-manjaro in ~/learn/js/vite-electron-builder
能不能提供一份 React TS 样板
Describe the bug
When I add env
object to preload API, it crashes the renderer window:
packages\preload\src\index.ts
const api: ElectronApi = {
env: process.env,
versions: process.versions,
}
packages\preload\types\electron-api.d.ts
interface ElectronApi {
readonly versions: Readonly<NodeJS.ProcessVersions>;
readonly env: Readonly<NodeJS.ProcessEnv>;
}
I'm new to Typescript. Am I doing something wrong?
If I serialize the object, it works:
const api: ElectronApi = {
env: JSON.stringify(process.env),
versions: process.versions,
}
But then I'd have to parse it in the renderer and declare env
as a string type, which doesn't make sense.
What can be causing the problem?
To Reproduce
Steps to reproduce the behavior:
vite-electron-builder
and add the code above to specified filesI add below code to renderer/app.vue
import {ipcRenderer} from 'electron';
then npm run watch
report errors index.js:4 Uncaught ReferenceError: __dirname is not defined
npm run compile
success, but load failed and report errors index.html:1 Uncaught TypeError: Failed to resolve module specifier "electron". Relative references must start with either "/", "./", or "../".
Hii @cawa-93 amazing repo. This works great with vue. Can we have a port of this project with React
. That will be great 😋⚛
I tried to use https://github.com/sindresorhus/electron-store, but it reported an error.
preload/index.ts
import * as Store from 'electron-store';
const api = {
getStore: () => new Store(),
}
some.vue
import { useElectron } from '@/use/electron';
const { getAppPath,getstore} = useElectron();
console.log(getstore()); // Then report an error
➜ vite-electron-builder git:(main) yarn
yarn install v1.22.17
info No lockfile found.
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
[3/5] 🚚 Fetching packages...
[4/5] 🔗 Linking dependencies...
warning " > @typescript-eslint/[email protected]" has unmet peer dependency "@typescript-eslint/parser@^5.0.0".
[5/5] 🔨 Building fresh packages...
success Saved lockfile.
✨ Done in 88.12s.
Renovation does not work properly:
You need to investigate the causes of these problems, fix them, and simplify configuration.
I want to somehow get the node
and chrome
versions that are sewn into the electron, and pass those versions to the esbuild
config and browserslist
config.
The following solution is currently in use:
Separate workflow has been update electron-vendors.config.json
and .browserslistrc
files on push to main branch.
I would like to receive the versions directly at the build
time.
Is your feature request related to a problem? Please describe.
Currently the template has IntelliJ IDEA settings built in. I think it would be more convenient for people not to have it in the template, especially if they use a different editor.
Describe the solution you'd like
I can make a PR with this if the author agrees
English is not my native language; please excuse typing errors.
Describe the bug
I am developing an opc-ua client.After install node-opcua and import it in preload.ts,the project reports an error.
To Reproduce
Steps to reproduce the behavior:
import { OPCUAClient, } from "node-opcua-client";
console.log(OPCUAClient);
Expected behavior
No error is reported, logs are printed normally.
Additional context
But When i use electron-quick-start-typescript,node-opcua works fine.
So I guess it’s a problem with code compilation.I tried for a long time, but didn't find a solution.
This will not provide any performance enhancement or any other technical benefits.
unify the system of modules throughout the project, regardless of the language and runtime environment.
The electron is currently working very poorly with esm. In addition, there is a share of modules that can not work with esm syntax.
Why is that called packages?? This isn't a monorepo for NPM packages so why don't we call it src?
Currently github has a bug that in case I'm not logged in / generate
shows 404. Can you add an alternate usage method in the readme: npx degit
?
Thanks
Describe the bug
First, I just want to say thank you so much for this fantastic template! I was using the Vue CLI Plugin Electron Builder, but it's not as up-to-date or as awesome as Vite, and this template made converting to Vite a breeze.
Now for the issue: the only change I made to the release.yml was as per the comment:
# To compile the application for different platforms, use:
# os: [ macos-latest, ubuntu-latest, windows-latest ]
I made that change as I'm wanting to release for all platforms, and now the release fails for ubuntu-latest. It still creates the app image perfectly, but crashes at the snap store. (I believe you can check the failed action here: https://github.com/ste163/vislit/runs/3794128439?check_suite_focus=true)
To Reproduce
[ macos-latest, ubuntu-latest, windows-latest ]
Expected behavior
The release should build for the snap store; however, I don't really need it. I'm good with just having the app image.
Screenshots
Error message:
Error: Command failed: npx --no-install electron-builder --linux --publish always --config electron-builder.config.js
• electron-builder version=22.11.7 os=5.8.0-1042-azure
• loaded configuration file=/home/runner/work/vislit/vislit/electron-builder.config.js
• description is missed in the package.json appPackageFile=/home/runner/work/vislit/vislit/package.json
• author is missed in the package.json appPackageFile=/home/runner/work/vislit/vislit/package.json
• packaging platform=linux arch=x64 electron=15.1.0 appOutDir=dist/linux-unpacked
• building target=snap arch=x64 file=dist/vislit_21.10.4-1033_amd64.snap
• building target=AppImage arch=x64 file=dist/vislit-21.10.4-1033.AppImage
• application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
• application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
• publishing publisher=Github (owner: ste163, project: vislit, version: 21.10.4-1033)
• uploading file=vislit-21.10.4-1033.AppImage provider=GitHub
• overwrite published file file=vislit-21.10.4-1033.AppImage reason=already exists on GitHub
• publishing publisher=Snap Store
• uploading file=vislit_21.10.4-1033_amd64.snap provider=snapStore
⨯ snapcraft is not installed, please: sudo snap install snapcraft --classic
⨯ /home/runner/work/vislit/vislit/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE failedTask=build stackTrace=Error: /home/runner/work/vislit/vislit/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
at ChildProcess.<anonymous> (/home/runner/work/vislit/vislit/node_modules/builder-util/src/util.ts:249:14)
at Object.onceWrapper (node:events:510:26)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
/home/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:144
throw err;
^
Error: Command failed: npx --no-install electron-builder --linux --publish always --config electron-builder.config.js
at checkExecSyncError (child_process.js:621:11)
at execSync (child_process.js:657:15)
at run (/home/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:21:27)
at runAction (/home/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:132:4)
at Object.<anonymous> (/home/runner/work/_actions/samuelmeuli/action-electron-builder/v1/index.js:150:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 2006,
stdout: null,
stderr: null
}
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
This repository is posited as an alternative to electron-webpack as the library is now in "maintenance mode" as stated in readme.
In electron-webpack, is it possible to share resources between main and renderer processes. This allows for best practices such as avoiding the hard-coding of event name strings for IPC communication via constants. In this case, common code resources are located in a folder which is a sibling to main and renderer folders.
Describe the solution you'd like
This repo should include configuration that enables sharing of code between main and renderer builds.
Describe alternatives you've considered
I've attempted to use the solution posited in this issue but this causes typescript errors. Aliases present DX issues because one can't use regular import statements like in webpack and must resort to some kind of module resolver which is beyond the scope of someone who wants to get started on an electron project quickly and easily.
Another solution I've attempted: move index.html file directly inside packages folder, setting the PACKAGE_ROOT to be packages folder. For renderer, main, and preload folders, in vite config files, change build.lib.entry value to be "[folderName]/src/index.ts" and change index.html script src to be "./renderer/src/index.tsx". This does not fix the issue and the watch tasks errors out:
Error: Cannot find module '../../common/constants'
Require stack:
- /home/user/code/polyhedral-net-factory/packages/main/dist/index.cjs
- /home/user/code/polyhedral-net-factory/node_modules/electron/dist/resources/default_app.asar/main.js
i don't know how to use ffi-napi in this demo,could anybody tell me if you have use this module successfully
git clone this
npm install
npm i element-plus
modify file in /src/renderer/index.ts
import { createApp } from 'vue';
import ElementPlus from 'element-plus';
import locale from 'element-plus/lib/locale/lang/es';
import App from './App.vue';
import router from '/@/router';
import 'dayjs/locale/es';
const app = createApp(App);
app.use(ElementPlus, { size: 'medium', locale });
app.use(router);
app.mount('#app');
add in file /src/renderer/App.vue
<i class="el-icon-edit"></i>
And finally run:
npm run watch
And ready in console.log show this error.
this happens with a fresh clean install of this template (commit 8e181e1 and earlier)
vite-electron-builder/packages/main/src/index.ts
Lines 15 to 19 in d4d7c73
The linked issue seems to be solved in TypeScript 4.2.0 which this package already uses.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.