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.

Path to static resources is baked in, cannot be set when using as a module

See original GitHub issue

When using the GUI as a node module in another project, you should be able to specify where to find static assets like images. Right now they are baked with /static/assets/... which works for www but makes it hard to use in other projects where those files might have a different path.

/cc @rschamp part of using GUI as a component of other projects

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
rschampcommented, Feb 28, 2019

I’m not sure what the best way to solve this is for the distributable module, but for our purposes in the short term the plan should be to inline loaders and point main (or just browser) to src/ so that the gui can be built by an external webpack config. Then the containing project can configure publicPath itself.

0reactions
chrisgarritycommented, Mar 13, 2019

Setting __webpack_public_path__ would work if we were building different versions of gui. Unfortunately, we’re building a consumer of gui (i.e. www and desktop), and the version of gui they use is already built (dist) and the static path for assets is already set. So the real solution is to use src/index.js as a browser entry point and let the consumer projects configure the static path and build gui as mentioned by @rschamp above. However, that would be a pretty big change for scratch-www, so for now the workaround is https://github.com/LLK/scratch-gui/pull/4646

Read more comments on GitHub >

github_iconTop Results From Across the Web

Files in static cannot be accessible in both local development ...
base and paths.assets are configured and the app is baked to a static site using the static adapter, this HTML will work because...
Read more >
Can't serve static files using express.Router? - Stack Overflow
From the express docs. the path that you provide to the express.static function is relative to the directory from where you launch your...
Read more >
Serve Static Resources with Spring - Baeldung
2. Using Spring Boot ... Spring Boot comes with a pre-configured implementation of ResourceHttpRequestHandler to facilitate serving static ...
Read more >
IIS and ASP.NET Core Rewrite Rules for Static Files and Html ...
Note that I leave the AspNetCore module path at * to allow anything not captured by the static file module mappings to still...
Read more >
How to manage static files (e.g. images, JavaScript, CSS)
In your templates, use the static template tag to build the URL for the given relative path using the configured STATICFILES_STORAGE .
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