Giter VIP home page Giter VIP logo

Comments (3)

zkat avatar zkat commented on July 30, 2024 1

I figured it out!

For anyone curious in the future about how to get this working with something like Obsidian: Electron apps often provide something like an app:// protocol, which is good enough for serving URLs that won't count as "local". So I just needed to find out how to grab the one for Obsidian, which is through plugin.app.vault.adapter.getResourcePath. Once I did the work of spitting out all the files from my bundle back into the filesystem, I just set the origin to a path based on getResourcePath and everything just worked! :)

from dice-box.

frankieali avatar frankieali commented on July 30, 2024

As far as I know, fetching from file:// is not allowed as it is a security problem.
The base path to assets is set here:

const basePath = `${this.config.origin}${this.config.assetPath}themes/${theme}`

It uses the config options origin and assetPath. origin defaults to window.location.origin
My only suggestion would be to try setting the config option origin to your file:// root path if you haven't tried that already.

from dice-box.

frankieali avatar frankieali commented on July 30, 2024

This example shows how origin was set to point to enable loading files from a different url. Not sure that it will work with file:// though.
https://codesandbox.io/p/sandbox/dice-es6-module-cdn-lhbs99?file=%2Fsrc%2Findex.js

from dice-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.