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.

Q: static assets when using modules

See original GitHub issue

Hello, can someone please guide me on how I can serve a static asset when using modules?

What I want to achieve: I have a worker that returns some html strings, I want to now serve some .css files so that I can use them in those html strings.

I’m using Miniflare v2 and if I’m understanding this correctly I need to setup a workers site, however I’m not entirely sure how to use getAssetFromKV when using modules. The example is using the non-modules approach and looking at the npm package https://www.npmjs.com/package/@cloudflare/kv-asset-handler does have a modules version but it doesn’t play nicely with miniflare (eg: the __STATIC_CONTENT_MANIFEST import).

Would appreciate any guidance 😄

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
donfericommented, Dec 17, 2021

@leader22 and @mrbbot thanks so much for your help. I got it working! 🕺 I wish I had more info on what I missed, but I basically started from scratch using both the test and @leader22’s example and worked as expected.

Thank you both so much, I really appreciate it!

0reactions
leader22commented, Feb 26, 2022

FYI 🗞️

Finally I found that Illegal invocation error was my fault. I updated my repo, bypassCache: true is not needed anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App Handling Assets | Quasar Framework
So let's try to answer the question above. We'll first talk about using regular assets then we'll see what the difference is for...
Read more >
Quasar assets vs statics directories - Stack Overflow
I am trying to understand the difference between assets and statics directories and when I should be using one or the other, especially...
Read more >
gruntwork-io/static-assets/google - Terraform Registry
This repo contains modules for managing static assets (CSS, JS, images) in GCP. Quickstart. If you want to quickly launch a static website...
Read more >
Chapter 7. Packages and Modules - Oracle Help Center
The import declarations allow types from packages in this module and other modules, as well as static members of types, to be referred...
Read more >
Webpack: When To Use And Why - Andy Ray's Blog
If your application is fairly small, and you don't have many static assets and you only need to build one Javascript file to...
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