Open HotHat opened 1 year ago
I don't know if this will help you.
Attempt to explicitly load resources in vite project. Make sure your paths are processed by Vite's import. This will ensure that it can be referenced after packaging.
<template>
<div>
<img :src="welcome_png" alt="" />
</div>
</template>
<script setup lang="ts">
import welcome_png from '/src/assets/image/welcome_png.png';
</script>
@fullmooooon Hi,
I can't find my mistake, as in web images work as expected, but not in electron. I think I read the whole Quasar-Electron documentation. Your advice did not help me either. I tried two different approaches:
<template>
<img :src="logo" />
</template>
<script setup>
import logo from "../assets/images/logo_text.svg";
// const logo = new URL('../assets/images/logo_text.svg', import.meta.url).href
</script>
When project is built, this is the rendered html:
<img data-v-416d72db="" src="assets/logo_text.4fffb5ab.svg" class="q-mx-auto img-logo-big">
This is the file tree that I receive, when I use
quasar build -m electron -P always
This is my quasar.config.js: `electron: {
inspectPort: 5858,
bundler: "builder", // 'packager' or 'builder'
packager: {
},
builder: {
appId: "vue3app",
},
},`
As you see, my app.exe is looking for the images in a ./assets folder in the same folder (win-unpackaged), but .assets is in another folder (UnPackaged).
i think i found some workaround that work but not recommended for production,
you can add this to your builder profile and it will include the assets folder until quasar team will fix the issue
builder: {
appId: "vue3app",
asar: false,
extraResources: [
{
from: './src/assets',
to: 'app/assets',
}]
}
What happened?
App window blank. index.xxxx.js and index.xxxx.css can't not load
css path not correct: file:///D:/Programming/Electron/quasar-project/dist/electron/Packaged/win-unpacked/resources/app.asar/index.html/assets/index.91f7b3e6.css
mybe this is the correct path: file:///D:/Programming/Electron/quasar-project/dist/electron/Packaged/win-unpacked/resources/app.asar/assets/index.91f7b3e6.css
What did you expect to happen?
App show the content
Reproduction URL
https://codepen.io/rstoenescu/pen/xxEvBLR
How to reproduce?
I can't now how to reproduce.
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)
Platforms/Browsers
Chrome
Quasar info output
Relevant log output
Additional context
No response