Closed lgrcia closed 4 years ago
Similar to #165, I tried to set webSecurity to false
Here is some proper context for my previous question (on a simple example):
Fresh electron-vue project with the following LandingPage.vue
:
<template>
<div id="wrapper">
<img id="logo" src="/an_absolute_path/default.png" alt="electron-vue">
</div>
</template>
Throw: Failed to load resource: the server responded with a status of 404 (Not Found)
vue init simulatedgreg/electron-vue another_test
cd another_test
npm install
npm run dev
and:
webSecurity
to false
in src/main/index.js:20
as specified in https://github.com/SimulatedGREG/electron-vue/issues/883#issuecomment-495364645 and #165:
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
webPreferences: {
webSecurity: false
},
})
The file is propely resolved outside of development though.
After:
npm run build
...
open build/mac/another_test.app
app runs fine:
Hope it'll help to spot an issue or a misunderstanding. Thank you for your time!
I would like to set the
src
of an<img>
to the path of an image from a newly created folder (not existing at build time).I know resolving assets questions are quite frequent but I cannot have the image created in the
asset
folder and webpack cannot resolve the path since the folder does not exists when compiling.I tried a solution with
app.getPath
from electron but with no success.Any advice?