electron-userland / electron-userland/electron-webpack

Referencing images from a JSON file

Open
#214 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
902
Forks
168
PR merge metrics
No merged PRs in 30d

Description

Hi,

Consider the following files inside `src/renderer`:
* `test.json` with the following content:
```json
{"icon": "@/img/test.png"}
```
* `img/test.png`
* `index.js` which creates the Vue app with the following:
```js
import test from "./test.json";
new Vue({
"data": () => ({
"src": test.icon
}),
"template": ''
});
```

But the URL from `test.json` does not seem to be processed by Webpack. I also tried to change the URL to `./img/test.png` which does not work better. I figured out that using `./test.png` actually works but I’m not sure why...

What is the proper way to handle such cases?

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.