question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Assets (e.g. SVG images and font files) are not being loaded correctly in built version of app using 3.0.0-alpha release

See original GitHub issue

Describe the bug I’m including font files and images that are stored in src/assets/img and src/assets/fonts. They are loading and displaying correctly when I npm run electron:serve, but not when I build the app (npm run electron:build).

The issue is the same using versions 3.0.0-alpha.1 and 3.0.0-alpha.3. The issue is not present in versions 2.x

PNG images are loading correctly - but not .svg, or font files (.woff2, .woff, and .ttf)

To Reproduce Steps to reproduce the behavior:

<img src="../assets/img/an-image.svg" >
  • build app using npm run electron:build
  • install / open the built application
  • observe that the image file does not display correctly, instead there is a placeholder like this:

image

Expected behavior Images and fonts should load

Environment (please complete the following information): Environment Info:

System: OS: macOS 12.1 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 16.13.1 - /opt/homebrew/bin/node Yarn: 1.22.17 - /opt/homebrew/bin/yarn npm: 8.1.2 - /opt/homebrew/bin/npm Browsers: Chrome: 97.0.4692.71 Edge: Not Found Firefox: 95.0.2 Safari: 15.2 npmPackages: @vue/babel-helper-vue-jsx-merge-props: 1.2.1 @vue/babel-helper-vue-transform-on: 1.0.2 @vue/babel-plugin-jsx: 1.1.1 @vue/babel-plugin-transform-vue-jsx: 1.2.1 @vue/babel-preset-app: 5.0.0-rc.2 @vue/babel-preset-jsx: 1.2.4 @vue/babel-sugar-composition-api-inject-h: 1.2.1 @vue/babel-sugar-composition-api-render-instance: 1.2.4 @vue/babel-sugar-functional-vue: 1.2.2 @vue/babel-sugar-inject-h: 1.2.2 @vue/babel-sugar-v-model: 1.2.3 @vue/babel-sugar-v-on: 1.2.3 @vue/cli-overlay: 5.0.0-rc.2 @vue/cli-plugin-babel: ~5.0.0-rc.2 => 5.0.0-rc.2 @vue/cli-plugin-eslint: ~5.0.0-rc.2 => 5.0.0-rc.2 @vue/cli-plugin-router: ~5.0.0-rc.2 => 5.0.0-rc.2 @vue/cli-plugin-unit-jest: ~5.0.0-rc.2 => 5.0.0-rc.2 @vue/cli-plugin-vuex: ~5.0.0-rc.2 => 5.0.0-rc.2 @vue/cli-service: ~5.0.0-rc.2 => 5.0.0-rc.2 @vue/cli-shared-utils: 5.0.0-rc.2 @vue/component-compiler-utils: 3.3.0 @vue/eslint-config-airbnb: ^6.0.0 => 6.0.0 @vue/test-utils: ^1.1.3 => 1.3.0 @vue/vue2-jest: ^27.0.0-alpha.2 => 27.0.0-alpha.4 @vue/web-component-wrapper: 1.3.0 eslint-plugin-vue: ^8.0.3 => 8.3.0 eslint-plugin-vuejs-accessibility: ^1.1.0 => 1.1.1 jest-serializer-vue: 2.0.2 vue: ^2.6.14 => 2.6.14 vue-cli-plugin-electron-builder: ^3.0.0-alpha.3 => 3.0.0-alpha.3 vue-eslint-parser: 8.0.1 vue-hot-reload-api: 2.3.4 vue-loader: 17.0.0 (15.9.8) vue-router: ^3.5.1 => 3.5.3 vue-style-loader: 4.1.3 vue-template-compiler: ^2.6.14 => 2.6.14 vue-template-es2015-compiler: 1.9.1 vuex: ^3.6.2 => 3.6.2 npmGlobalPackages: @vue/cli: 5.0.0-rc.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
vangorkcommented, Jan 23, 2022

My temp workaround is to change Electron Builder config to customFileProtocol: './'. and win.loadURL(file://${__dirname}/index.html). Not sure if there is any side effect.

3reactions
mrbudscommented, Mar 8, 2022

I had same issue but only with fonts (working on dev, not on build) customFileProtocol: './' fixed it, thanks @vangork

edit: i’m using 3.0.0-alpha.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

can I use svg image file in xcode? | Apple Developer Forums
Can I use svg image file for iPhone application in xcode any version . If its possible so how I will do it?...
Read more >
svg fonts are not loading on a webpage using @font-face in ...
Declare the embedded font inside our SVG file. Edit our SVG file that's using the font. Declare @font-face inside the tag. Put the...
Read more >
Unity 2022.1.0
Android: Enabled the Unity Editor to create asset packs if you build an Android App Bundle with Split App Binary enabled.
Read more >
Add multi-density vector graphics - Android Developers
Android Studio includes a tool called Vector Asset Studio that helps you add material icons and import Scalable Vector Graphic (SVG) and ...
Read more >
Release notes | U.S. Web Design System (USWDS) - Digital.gov
We've been listening to your feedback and using it as a basis for improvements and additions. Here you'll find our release notes —...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found