How do I use assets correctly?
See original GitHub issueHey! When running in dev mode, the following works:
// Component in src/components/
<img src="../../assets/icon.svg" />
… and using any other path here doesn’t seem to work.
But then, when running build
, I get the following error:
error during build:
Error: Could not resolve '../../assets/icon.svg' from src/components/Tweets.vue
at error (/Users/user/code/bugle-vue/node_modules/.pnpm/rollup@2.57.0/node_modules/rollup/dist/shared/rollup.js:158:30)
at ModuleLoader.handleResolveId (/Users/user/code/bugle-vue/node_modules/.pnpm/rollup@2.57.0/node_modules/rollup/dist/shared/rollup.js:22263:24)
at /Users/user/code/bugle-vue/node_modules/.pnpm/rollup@2.57.0/node_modules/rollup/dist/shared/rollup.js:22257:26
ELIFECYCLE Command failed with exit code 1.
ERROR: "build:web" exited with 1.
ELIFECYCLE Command failed with exit code 1.
How do I use assets correctly?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
What Is an Asset? Definition, Types, and Examples
An asset is a resource with economic value that an individual or corporation owns or controls with the expectation that it will provide...
Read more >8 Tips on Managing Your Business Assets Wisely
7. Leverage Your Assets in Valuing Your Business. If you decide to take out a loan, seek funding or sell your business, your...
Read more >How to Calculate Total Assets: Definition & Examples
It can also be used to check if your total assets figure is correct, according to The Balance. The formula is: Total Liabilities...
Read more >Fixed-Asset Accounting Basics
These procedures include documenting financial records, calculating revenue, estimating fixed-asset valuations and complying with tax laws.
Read more >6 Types of Business Assets and How to Record Them
The easiest, most accurate way to manage and record your assets is by using accounting software, but even if you're using a manual ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Couldn’t figure out how to use assets too, made some search so here is a summary :
extension/assets
is a directory for the manifest assets only.src/assets
folder and include them with<img src="/assets/icon.svg" alt="" />
. Assets included in the app will be copied to theextension/dist/assets
folder on build.At that point everything is working but you might have duplicated assets inside
extension/assets
andsrc/assets
. To avoid that, you can create a script that will copy files fromsrc/assets/static
toextension/assets
. It will be used the same way asmanifest.ts
write themanifest.json
file.Create the script to copy files, inside
scripts/static-assets.ts
Then edit
scripts/prepare.ts
to execute our script :Hope this helps someone !
@tmkx Solved it!